diff --git a/metricflow/dag/id_generation.py b/metricflow/dag/id_generation.py index 913457a798..e08fca06de 100644 --- a/metricflow/dag/id_generation.py +++ b/metricflow/dag/id_generation.py @@ -35,6 +35,7 @@ SQL_EXPR_IS_NULL_PREFIX = "isn" SQL_EXPR_CAST_TO_TIMESTAMP_PREFIX = "ctt" SQL_EXPR_DATE_TRUNC = "dt" +SQL_EXPR_EXTRACT = "ex" SQL_EXPR_RATIO_COMPUTATION = "rc" SQL_EXPR_BETWEEN_PREFIX = "betw" SQL_EXPR_WINDOW_FUNCTION_ID_PREFIX = "wfnc" diff --git a/metricflow/dataset/convert_semantic_model.py b/metricflow/dataset/convert_semantic_model.py index 99a0ea74ea..296168df21 100644 --- a/metricflow/dataset/convert_semantic_model.py +++ b/metricflow/dataset/convert_semantic_model.py @@ -38,6 +38,7 @@ SqlColumnReferenceExpression, SqlDateTruncExpression, SqlExpressionNode, + SqlExtractExpression, SqlStringExpression, ) from metricflow.sql.sql_plan import ( @@ -46,6 +47,7 @@ SqlSelectStatementNode, SqlTableFromClauseNode, ) +from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -102,12 +104,14 @@ def _create_time_dimension_instance( time_dimension: Dimension, entity_links: Tuple[EntityReference, ...], time_granularity: TimeGranularity = DEFAULT_TIME_GRANULARITY, + date_part: Optional[DatePart] = None, ) -> TimeDimensionInstance: """Create a time dimension instance from the dimension object from a semantic model in the model.""" time_dimension_spec = TimeDimensionSpec( element_name=time_dimension.reference.element_name, entity_links=entity_links, time_granularity=time_granularity, + date_part=date_part, ) return TimeDimensionInstance( @@ -219,6 +223,11 @@ def _convert_dimensions( select_columns = [] for dimension in dimensions or []: + dimension_select_expr = SemanticModelToDataSetConverter._make_element_sql_expr( + table_alias=table_alias, + element_name=dimension.reference.element_name, + element_expr=dimension.expr, + ) if dimension.type == DimensionType.CATEGORICAL: dimension_instance = self._create_dimension_instance( semantic_model_name=semantic_model_name, @@ -228,11 +237,7 @@ def _convert_dimensions( dimension_instances.append(dimension_instance) select_columns.append( SqlSelectColumn( - expr=SemanticModelToDataSetConverter._make_element_sql_expr( - table_alias=table_alias, - element_name=dimension.reference.element_name, - element_expr=dimension.expr, - ), + expr=dimension_select_expr, column_alias=dimension_instance.associated_column.column_name, ) ) @@ -251,11 +256,7 @@ def _convert_dimensions( time_dimension_instances.append(time_dimension_instance) select_columns.append( SqlSelectColumn( - expr=SemanticModelToDataSetConverter._make_element_sql_expr( - table_alias=table_alias, - element_name=dimension.reference.element_name, - element_expr=dimension.expr, - ), + expr=dimension_select_expr, column_alias=time_dimension_instance.associated_column.column_name, ) ) @@ -274,16 +275,31 @@ def _convert_dimensions( select_columns.append( SqlSelectColumn( expr=SqlDateTruncExpression( - time_granularity=time_granularity, - arg=SemanticModelToDataSetConverter._make_element_sql_expr( - table_alias=table_alias, - element_name=dimension.reference.element_name, - element_expr=dimension.expr, - ), + time_granularity=time_granularity, arg=dimension_select_expr ), column_alias=time_dimension_instance.associated_column.column_name, ) ) + + # Add all date part options for easy query resolution + for date_part in DatePart: + if date_part.to_int() >= defined_time_granularity.to_int(): + time_dimension_instance = self._create_time_dimension_instance( + semantic_model_name=semantic_model_name, + time_dimension=dimension, + entity_links=entity_links, + time_granularity=defined_time_granularity, + date_part=date_part, + ) + time_dimension_instances.append(time_dimension_instance) + + select_columns.append( + SqlSelectColumn( + expr=SqlExtractExpression(date_part=date_part, arg=dimension_select_expr), + column_alias=time_dimension_instance.associated_column.column_name, + ) + ) + else: assert False, f"Unhandled dimension type: {dimension.type}" diff --git a/metricflow/naming/linkable_spec_name.py b/metricflow/naming/linkable_spec_name.py index 082f81cb84..1cfe2b9804 100644 --- a/metricflow/naming/linkable_spec_name.py +++ b/metricflow/naming/linkable_spec_name.py @@ -6,6 +6,8 @@ from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity +from metricflow.time.date_part import DatePart + DUNDER = "__" logger = logging.getLogger(__name__) @@ -24,6 +26,7 @@ class StructuredLinkableSpecName: entity_link_names: Tuple[str, ...] element_name: str time_granularity: Optional[TimeGranularity] = None + date_part: Optional[DatePart] = None @staticmethod def from_name(qualified_name: str) -> StructuredLinkableSpecName: @@ -32,7 +35,26 @@ def from_name(qualified_name: str) -> StructuredLinkableSpecName: # No dunder, e.g. "ds" if len(name_parts) == 1: - return StructuredLinkableSpecName((), name_parts[0]) + return StructuredLinkableSpecName(entity_link_names=(), element_name=name_parts[0]) + + associated_date_part: Optional[DatePart] = None + for date_part in DatePart: + if name_parts[-1] == StructuredLinkableSpecName.date_part_suffix(date_part): + associated_date_part = date_part + + # Has a date_part + if associated_date_part: + # e.g. "ds__extract_month" + if len(name_parts) == 2: + return StructuredLinkableSpecName( + entity_link_names=(), element_name=name_parts[0], date_part=associated_date_part + ) + # e.g. "messages__ds__extract_month" + return StructuredLinkableSpecName( + entity_link_names=tuple(name_parts[:-2]), + element_name=name_parts[-2], + date_part=associated_date_part, + ) associated_granularity = None granularity: TimeGranularity @@ -44,19 +66,29 @@ def from_name(qualified_name: str) -> StructuredLinkableSpecName: if associated_granularity: # e.g. "ds__month" if len(name_parts) == 2: - return StructuredLinkableSpecName((), name_parts[0], associated_granularity) + return StructuredLinkableSpecName( + entity_link_names=(), element_name=name_parts[0], time_granularity=associated_granularity + ) # e.g. "messages__ds__month" - return StructuredLinkableSpecName(tuple(name_parts[:-2]), name_parts[-2], associated_granularity) + return StructuredLinkableSpecName( + entity_link_names=tuple(name_parts[:-2]), + element_name=name_parts[-2], + time_granularity=associated_granularity, + ) + # e.g. "messages__ds" else: - return StructuredLinkableSpecName(tuple(name_parts[:-1]), name_parts[-1]) + return StructuredLinkableSpecName(entity_link_names=tuple(name_parts[:-1]), element_name=name_parts[-1]) @property def qualified_name(self) -> str: """Return the full name form. e.g. ds or listing__ds__month.""" items = list(self.entity_link_names) + [self.element_name] - if self.time_granularity: + if self.date_part: + items.append(self.date_part_suffix(date_part=self.date_part)) + elif self.time_granularity: items.append(self.time_granularity.value) + return DUNDER.join(items) @property @@ -66,3 +98,8 @@ def entity_prefix(self) -> Optional[str]: return DUNDER.join(self.entity_link_names) return None + + @staticmethod + def date_part_suffix(date_part: DatePart) -> str: + """Suffix used for names with a date_part.""" + return f"extract_{date_part.value}" diff --git a/metricflow/plan_conversion/column_resolver.py b/metricflow/plan_conversion/column_resolver.py index 7dc1124aa4..9312fd7f30 100644 --- a/metricflow/plan_conversion/column_resolver.py +++ b/metricflow/plan_conversion/column_resolver.py @@ -55,6 +55,7 @@ def visit_time_dimension_spec(self, time_dimension_spec: TimeDimensionSpec) -> C entity_link_names=tuple(x.element_name for x in time_dimension_spec.entity_links), element_name=time_dimension_spec.element_name, time_granularity=time_dimension_spec.time_granularity, + date_part=time_dimension_spec.date_part, ).qualified_name return ColumnAssociation( diff --git a/metricflow/plan_conversion/dataflow_to_sql.py b/metricflow/plan_conversion/dataflow_to_sql.py index d350ff17e8..8f80437a08 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -1116,6 +1116,7 @@ def visit_metric_time_dimension_transform_node( if ( len(time_dimension_instance.spec.entity_links) == 0 and time_dimension_instance.spec.reference == node.aggregation_time_dimension_reference + and time_dimension_instance.spec.date_part is None ): matching_time_dimension_instances.append(time_dimension_instance) @@ -1141,6 +1142,7 @@ def visit_metric_time_dimension_transform_node( output_column_to_input_column[ metric_time_dimension_column_association.column_name ] = matching_time_dimension_instance.associated_column.column_name + output_instance_set = InstanceSet( measure_instances=tuple(output_measure_instances), dimension_instances=input_data_set.instance_set.dimension_instances, @@ -1359,7 +1361,7 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode[SourceDataSetT SqlColumnReference(table_alias=time_spine_alias, column_name=original_time_dim_instance.spec.qualified_name) ) - # Add requested granularities (skip for default granularity). + # Add requested granularities (skip for default granularity) and date_parts. metric_time_select_columns = [] metric_time_dimension_instances = [] where: Optional[SqlExpressionNode] = None @@ -1376,6 +1378,7 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode[SourceDataSetT element_name=original_time_dim_instance.spec.element_name, entity_links=original_time_dim_instance.spec.entity_links, time_granularity=metric_time_dimension_spec.time_granularity, + date_part=metric_time_dimension_spec.date_part, aggregation_state=original_time_dim_instance.spec.aggregation_state, ) time_dim_instance = TimeDimensionInstance( diff --git a/metricflow/plan_conversion/instance_converters.py b/metricflow/plan_conversion/instance_converters.py index 0620598c8d..d741d8f711 100644 --- a/metricflow/plan_conversion/instance_converters.py +++ b/metricflow/plan_conversion/instance_converters.py @@ -401,6 +401,7 @@ def transform(self, instance_set: InstanceSet) -> InstanceSet: # noqa: D + time_dimension_instance.spec.entity_links ), time_granularity=time_dimension_instance.spec.time_granularity, + date_part=time_dimension_instance.spec.date_part, ) time_dimension_instances_with_additional_link.append( TimeDimensionInstance( diff --git a/metricflow/specs/specs.py b/metricflow/specs/specs.py index 46e071a30b..f065c0d693 100644 --- a/metricflow/specs/specs.py +++ b/metricflow/specs/specs.py @@ -34,6 +34,7 @@ from metricflow.naming.linkable_spec_name import StructuredLinkableSpecName from metricflow.sql.sql_bind_parameters import SqlBindParameters from metricflow.sql.sql_column_type import SqlColumnType +from metricflow.time.date_part import DatePart from metricflow.visitor import VisitorOutputT @@ -284,6 +285,7 @@ def accept(self, visitor: InstanceSpecVisitor[VisitorOutputT]) -> VisitorOutputT @dataclass(frozen=True) class TimeDimensionSpec(DimensionSpec): # noqa: D time_granularity: TimeGranularity = DEFAULT_TIME_GRANULARITY + date_part: Optional[DatePart] = None # Used for semi-additive joins. Some more thought is needed, but this may be useful in InstanceSpec. aggregation_state: Optional[AggregationState] = None @@ -295,6 +297,7 @@ def without_first_entity_link(self) -> TimeDimensionSpec: # noqa: D element_name=self.element_name, entity_links=self.entity_links[1:], time_granularity=self.time_granularity, + date_part=self.date_part, ) @property @@ -338,6 +341,7 @@ def with_aggregation_state(self, aggregation_state: AggregationState) -> TimeDim element_name=self.element_name, entity_links=self.entity_links, time_granularity=self.time_granularity, + date_part=self.date_part, aggregation_state=aggregation_state, ) diff --git a/metricflow/specs/where_filter_time_dimension.py b/metricflow/specs/where_filter_time_dimension.py index 18ed235a81..0dd23ad0d4 100644 --- a/metricflow/specs/where_filter_time_dimension.py +++ b/metricflow/specs/where_filter_time_dimension.py @@ -86,4 +86,6 @@ def _convert_to_time_dimension_spec( element_name=parameter_set.time_dimension_reference.element_name, entity_links=parameter_set.entity_path, time_granularity=parameter_set.time_granularity, + # TODO: add date_part to TimeDimensionCallParameterSet in DSI + # date_part=parameter_set.date_part, ) diff --git a/metricflow/sql/render/databricks.py b/metricflow/sql/render/databricks.py index 0740f66350..307f15ba24 100644 --- a/metricflow/sql/render/databricks.py +++ b/metricflow/sql/render/databricks.py @@ -13,6 +13,7 @@ ) from metricflow.sql.render.sql_plan_renderer import DefaultSqlQueryPlanRenderer from metricflow.sql.sql_exprs import SqlPercentileExpression, SqlPercentileFunctionType +from metricflow.time.date_part import DatePart class DatabricksSqlExpressionRenderer(DefaultSqlExpressionRenderer): @@ -56,6 +57,13 @@ def visit_percentile_expr(self, node: SqlPercentileExpression) -> SqlExpressionR bind_parameters=params, ) + @override + def render_date_part(self, date_part: DatePart) -> str: + if date_part == DatePart.DAYOFYEAR: + return "DOY" + + return super().render_date_part(date_part) + class DatabricksSqlQueryPlanRenderer(DefaultSqlQueryPlanRenderer): """Plan renderer for the Snowflake engine.""" diff --git a/metricflow/sql/render/expr_renderer.py b/metricflow/sql/render/expr_renderer.py index 26a4e0065c..105c83e862 100644 --- a/metricflow/sql/render/expr_renderer.py +++ b/metricflow/sql/render/expr_renderer.py @@ -22,6 +22,7 @@ SqlDateTruncExpression, SqlExpressionNode, SqlExpressionNodeVisitor, + SqlExtractExpression, SqlFunction, SqlGenerateUuidExpression, SqlIsNullExpression, @@ -36,6 +37,7 @@ SqlWindowFunctionExpression, ) from metricflow.sql.sql_plan import SqlSelectColumn +from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -267,6 +269,18 @@ def visit_date_trunc_expr(self, node: SqlDateTruncExpression) -> SqlExpressionRe bind_parameters=arg_rendered.bind_parameters, ) + def visit_extract_expr(self, node: SqlExtractExpression) -> SqlExpressionRenderResult: # noqa: D + arg_rendered = self.render_sql_expr(node.arg) + + return SqlExpressionRenderResult( + sql=f"EXTRACT({self.render_date_part(node.date_part)} FROM {arg_rendered.sql})", + bind_parameters=arg_rendered.bind_parameters, + ) + + def render_date_part(self, date_part: DatePart) -> str: + """Render DATE PART for an EXTRACT expression.""" + return date_part.name + def visit_time_delta_expr(self, node: SqlTimeDeltaExpression) -> SqlExpressionRenderResult: # noqa: D arg_rendered = node.arg.accept(self) if node.grain_to_date: diff --git a/metricflow/sql/sql_exprs.py b/metricflow/sql/sql_exprs.py index 10e72826aa..8ab96a29e9 100644 --- a/metricflow/sql/sql_exprs.py +++ b/metricflow/sql/sql_exprs.py @@ -19,6 +19,7 @@ SQL_EXPR_COLUMN_REFERENCE_ID_PREFIX, SQL_EXPR_COMPARISON_ID_PREFIX, SQL_EXPR_DATE_TRUNC, + SQL_EXPR_EXTRACT, SQL_EXPR_FUNCTION_ID_PREFIX, SQL_EXPR_GENERATE_UUID_PREFIX, SQL_EXPR_IS_NULL_PREFIX, @@ -32,6 +33,7 @@ ) from metricflow.dag.mf_dag import DagNode, DisplayedProperty, NodeId from metricflow.sql.sql_bind_parameters import SqlBindParameters +from metricflow.time.date_part import DatePart from metricflow.visitor import Visitable, VisitorOutputT @@ -218,6 +220,10 @@ def visit_cast_to_timestamp_expr(self, node: SqlCastToTimestampExpression) -> Vi def visit_date_trunc_expr(self, node: SqlDateTruncExpression) -> VisitorOutputT: # noqa: D pass + @abstractmethod + def visit_extract_expr(self, node: SqlExtractExpression) -> VisitorOutputT: # noqa: D + pass + @abstractmethod def visit_time_delta_expr(self, node: SqlTimeDeltaExpression) -> VisitorOutputT: # noqa: D pass @@ -1416,6 +1422,64 @@ def matches(self, other: SqlExpressionNode) -> bool: # noqa: D return self.time_granularity == other.time_granularity and self._parents_match(other) +class SqlExtractExpression(SqlExpressionNode): + """Extract a date part from a time expression.""" + + def __init__(self, date_part: DatePart, arg: SqlExpressionNode) -> None: + """Constructor. + + Args: + date_part: the date part to extract. + arg: the expression to extract from. + """ + self._date_part = date_part + super().__init__(node_id=self.create_unique_id(), parent_nodes=[arg]) + + @classmethod + def id_prefix(cls) -> str: # noqa: D + return SQL_EXPR_EXTRACT + + @property + def requires_parenthesis(self) -> bool: # noqa: D + return False + + def accept(self, visitor: SqlExpressionNodeVisitor[VisitorOutputT]) -> VisitorOutputT: # noqa: D + return visitor.visit_extract_expr(self) + + @property + def description(self) -> str: # noqa: D + return f"Extract {self.date_part.name}" + + @property + def date_part(self) -> DatePart: # noqa: D + return self._date_part + + @property + def arg(self) -> SqlExpressionNode: # noqa: D + assert len(self.parent_nodes) == 1 + return self.parent_nodes[0] + + def rewrite( # noqa: D + self, + column_replacements: Optional[SqlColumnReplacements] = None, + should_render_table_alias: Optional[bool] = None, + ) -> SqlExpressionNode: + return SqlExtractExpression( + date_part=self.date_part, arg=self.arg.rewrite(column_replacements, should_render_table_alias) + ) + + @property + def lineage(self) -> SqlExpressionTreeLineage: # noqa: D + return SqlExpressionTreeLineage.combine( + tuple(x.lineage for x in self.parent_nodes) + (SqlExpressionTreeLineage(other_exprs=(self,)),) + ) + + def matches(self, other: SqlExpressionNode) -> bool: # noqa: D + if not isinstance(other, SqlExtractExpression): + return False + return self.date_part == other.date_part and self._parents_match(other) + + class SqlRatioComputationExpression(SqlExpressionNode): """Node for expressing Ratio metrics to allow for appropriate casting to float/double in each engine. diff --git a/metricflow/test/dataset/test_convert_semantic_model.py b/metricflow/test/dataset/test_convert_semantic_model.py index 3335742f2a..d830438ea5 100644 --- a/metricflow/test/dataset/test_convert_semantic_model.py +++ b/metricflow/test/dataset/test_convert_semantic_model.py @@ -19,6 +19,7 @@ from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState from metricflow.test.sql.compare_sql_plan import assert_rendered_sql_equal +from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -49,6 +50,27 @@ def test_convert_table_semantic_model_without_measures( # noqa: D TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.MONTH), TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.QUARTER), TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.YEAR), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.WEEK + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAYOFWEEK + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAYOFYEAR + ), TimeDimensionSpec( element_name="ds", entity_links=(EntityReference(element_name="user"),), @@ -74,6 +96,48 @@ def test_convert_table_semantic_model_without_measures( # noqa: D entity_links=(EntityReference(element_name="user"),), time_granularity=TimeGranularity.YEAR, ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.YEAR, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.QUARTER, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.MONTH, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.WEEK, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAY, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFWEEK, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFYEAR, + ), ), ) @@ -125,11 +189,74 @@ def test_convert_table_semantic_model_with_measures( # noqa: D TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.MONTH), TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.QUARTER), TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.YEAR), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.WEEK + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAYOFWEEK + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAYOFYEAR + ), TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.DAY), TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.WEEK), TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.MONTH), TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.QUARTER), TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.YEAR), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.YEAR, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.QUARTER, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.MONTH, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.WEEK, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAY, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFWEEK, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFYEAR, + ), TimeDimensionSpec( element_name="ds", entity_links=(EntityReference(element_name="verification"),), @@ -155,6 +282,48 @@ def test_convert_table_semantic_model_with_measures( # noqa: D entity_links=(EntityReference(element_name="verification"),), time_granularity=TimeGranularity.YEAR, ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.YEAR, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.QUARTER, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.MONTH, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.WEEK, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAY, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFWEEK, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFYEAR, + ), TimeDimensionSpec( element_name="ds_partitioned", entity_links=(EntityReference(element_name="verification"),), @@ -180,6 +349,48 @@ def test_convert_table_semantic_model_with_measures( # noqa: D entity_links=(EntityReference(element_name="verification"),), time_granularity=TimeGranularity.YEAR, ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.YEAR, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.QUARTER, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.MONTH, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.WEEK, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAY, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFWEEK, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DAYOFYEAR, + ), ), ) diff --git a/metricflow/test/model/test_data_warehouse_tasks.py b/metricflow/test/model/test_data_warehouse_tasks.py index 1c66625f22..3675751f40 100644 --- a/metricflow/test/model/test_data_warehouse_tasks.py +++ b/metricflow/test/model/test_data_warehouse_tasks.py @@ -110,8 +110,8 @@ def test_build_dimension_tasks( # noqa: D ) # on semantic model query with all dimensions assert len(tasks) == 1 - # 1 categorical dimension task, 1 time dimension task, 4 granularity based time dimension tasks - assert len(tasks[0].on_fail_subtasks) == 6 + # 1 categorical dimension task, 1 time dimension task, 4 granularity based time dimension tasks, 7 date_part tasks + assert len(tasks[0].on_fail_subtasks) == 13 def test_validate_dimensions( # noqa: D diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql index bf1aa949c1..6a18fb55ab 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql @@ -6,11 +6,25 @@ SELECT , DATE_TRUNC(revenue_src_10006.created_at, month) AS ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS company__ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql index c2ce705484..be4db1864b 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql @@ -6,22 +6,50 @@ SELECT , DATE_TRUNC(id_verifications_src_10003.ds, month) AS ds__month , DATE_TRUNC(id_verifications_src_10003.ds, quarter) AS ds__quarter , DATE_TRUNC(id_verifications_src_10003.ds, year) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC(id_verifications_src_10003.ds, isoweek) AS verification__ds__week , DATE_TRUNC(id_verifications_src_10003.ds, month) AS verification__ds__month , DATE_TRUNC(id_verifications_src_10003.ds, quarter) AS verification__ds__quarter , DATE_TRUNC(id_verifications_src_10003.ds, year) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS verification__ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS verification__ds_partitioned__month , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, quarter) AS verification__ds_partitioned__quarter , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, year) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql index 73911c3dd1..b4f8805489 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql @@ -5,12 +5,26 @@ SELECT , DATE_TRUNC(users_latest_src_10008.ds, month) AS ds__month , DATE_TRUNC(users_latest_src_10008.ds, quarter) AS ds__quarter , DATE_TRUNC(users_latest_src_10008.ds, year) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS ds__extract_dayofyear , users_latest_src_10008.home_state_latest , users_latest_src_10008.ds AS user__ds__day , DATE_TRUNC(users_latest_src_10008.ds, isoweek) AS user__ds__week , DATE_TRUNC(users_latest_src_10008.ds, month) AS user__ds__month , DATE_TRUNC(users_latest_src_10008.ds, quarter) AS user__ds__quarter , DATE_TRUNC(users_latest_src_10008.ds, year) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS user__ds__extract_dayofyear , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql index 896ee2afd1..28bd5c725b 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql @@ -6,11 +6,25 @@ SELECT , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql index cfaaed9f09..dbb952f05b 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql @@ -6,22 +6,50 @@ SELECT , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql index 75e1612840..60db7389f0 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql @@ -5,12 +5,26 @@ SELECT , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM users_latest_src_10008.ds) AS ds__extract_dayofyear , users_latest_src_10008.home_state_latest , users_latest_src_10008.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_dayofweek + , EXTRACT(DOY FROM users_latest_src_10008.ds) AS user__ds__extract_dayofyear , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql index 896ee2afd1..390e922160 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql @@ -6,11 +6,25 @@ SELECT , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql index cfaaed9f09..4a4b1f53f4 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql @@ -6,22 +6,50 @@ SELECT , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql index 75e1612840..e3f2a1d31a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql @@ -5,12 +5,26 @@ SELECT , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS ds__extract_dayofyear , users_latest_src_10008.home_state_latest , users_latest_src_10008.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS user__ds__extract_dayofyear , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql index 896ee2afd1..390e922160 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql @@ -6,11 +6,25 @@ SELECT , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql index cfaaed9f09..4a4b1f53f4 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql @@ -6,22 +6,50 @@ SELECT , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql index 75e1612840..e3f2a1d31a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql @@ -5,12 +5,26 @@ SELECT , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS ds__extract_dayofyear , users_latest_src_10008.home_state_latest , users_latest_src_10008.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS user__ds__extract_dayofyear , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql index 896ee2afd1..390e922160 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql @@ -6,11 +6,25 @@ SELECT , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql index cfaaed9f09..4a4b1f53f4 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql @@ -6,22 +6,50 @@ SELECT , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql index 75e1612840..e3f2a1d31a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql @@ -5,12 +5,26 @@ SELECT , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS ds__extract_dayofyear , users_latest_src_10008.home_state_latest , users_latest_src_10008.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS user__ds__extract_dayofyear , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql index 896ee2afd1..390e922160 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql @@ -6,11 +6,25 @@ SELECT , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql index cfaaed9f09..4a4b1f53f4 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql @@ -6,22 +6,50 @@ SELECT , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql index 75e1612840..e3f2a1d31a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql @@ -5,12 +5,26 @@ SELECT , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS ds__extract_dayofyear , users_latest_src_10008.home_state_latest , users_latest_src_10008.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10008.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10008.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10008.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10008.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10008.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS user__ds__extract_dayofyear , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml index ff4e3095e1..fea487abac 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml @@ -34,6 +34,7 @@ + @@ -65,6 +66,7 @@ + @@ -132,6 +134,7 @@ + @@ -163,6 +166,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml index 4aac7f8a75..315dbe3f63 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml @@ -29,6 +29,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml index 3d6d6e3630..8c87a7ea7c 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml @@ -29,6 +29,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml index babc67f7c8..0ea5b4678a 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml @@ -43,6 +43,7 @@ + @@ -86,6 +87,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml index a8ecff962b..97bb2cf97f 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml @@ -41,6 +41,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml index 0cedbbee96..f2f1132769 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml @@ -41,6 +41,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml index a2ee6ee189..17be7c1387 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml @@ -41,6 +41,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml index 6c68f6700e..8b12c3de7b 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml @@ -33,6 +33,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml index 9a2f8e0984..ba549be3d2 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml @@ -53,6 +53,7 @@ + @@ -86,6 +87,7 @@ + @@ -113,6 +115,7 @@ + @@ -191,6 +194,7 @@ + @@ -224,6 +228,7 @@ + @@ -251,6 +256,7 @@ + @@ -319,6 +325,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml index 814ba44eff..749bda11de 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml @@ -53,6 +53,7 @@ + @@ -86,6 +87,7 @@ + @@ -131,6 +133,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml index de477d1c55..dd83dca62a 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml @@ -47,6 +47,7 @@ + @@ -74,6 +75,7 @@ + @@ -145,6 +147,7 @@ + @@ -172,6 +175,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml index 0513c678ae..e29686410d 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml @@ -44,11 +44,13 @@ + + @@ -65,6 +67,7 @@ + @@ -97,6 +100,7 @@ + @@ -117,11 +121,13 @@ + + @@ -143,11 +149,25 @@ + + + + + + + + + + + + + + @@ -168,60 +188,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml index 7db1f469eb..b34126863d 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml @@ -38,6 +38,7 @@ + @@ -85,6 +86,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml index 4e848370c1..ea902f79a7 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml @@ -14,6 +14,7 @@ + @@ -56,6 +57,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml index 3469a47a37..0fc68ed052 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml @@ -47,6 +47,7 @@ + @@ -74,6 +75,7 @@ + @@ -145,6 +147,7 @@ + @@ -172,6 +175,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml index 84cda54d21..c5493a3239 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml @@ -41,6 +41,7 @@ + @@ -61,6 +62,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml index d5d1074893..9ab80bd341 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml @@ -35,6 +35,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml index 2ead8da01d..4f3968902a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml @@ -35,6 +35,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml index 6abd3f4209..5f87539f4f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/DataflowPlan/test_join_to_time_spine_node_without_offset__plan0.xml @@ -35,6 +35,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql index 1e2968eecd..b320e6bd7b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -239,32 +365,74 @@ FULL OUTER JOIN ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql index f8fa505210..c647a56b30 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index ec37329539..0715f5e0da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -51,31 +51,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -125,32 +167,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -175,21 +259,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -218,11 +330,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -231,11 +357,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -296,21 +436,49 @@ FROM ( , subq_10.ds__month , subq_10.ds__quarter , subq_10.ds__year + , subq_10.ds__extract_year + , subq_10.ds__extract_quarter + , subq_10.ds__extract_month + , subq_10.ds__extract_week + , subq_10.ds__extract_day + , subq_10.ds__extract_dayofweek + , subq_10.ds__extract_dayofyear , subq_10.ds_partitioned__day , subq_10.ds_partitioned__week , subq_10.ds_partitioned__month , subq_10.ds_partitioned__quarter , subq_10.ds_partitioned__year + , subq_10.ds_partitioned__extract_year + , subq_10.ds_partitioned__extract_quarter + , subq_10.ds_partitioned__extract_month + , subq_10.ds_partitioned__extract_week + , subq_10.ds_partitioned__extract_day + , subq_10.ds_partitioned__extract_dayofweek + , subq_10.ds_partitioned__extract_dayofyear , subq_10.view__ds__day , subq_10.view__ds__week , subq_10.view__ds__month , subq_10.view__ds__quarter , subq_10.view__ds__year + , subq_10.view__ds__extract_year + , subq_10.view__ds__extract_quarter + , subq_10.view__ds__extract_month + , subq_10.view__ds__extract_week + , subq_10.view__ds__extract_day + , subq_10.view__ds__extract_dayofweek + , subq_10.view__ds__extract_dayofyear , subq_10.view__ds_partitioned__day , subq_10.view__ds_partitioned__week , subq_10.view__ds_partitioned__month , subq_10.view__ds_partitioned__quarter , subq_10.view__ds_partitioned__year + , subq_10.view__ds_partitioned__extract_year + , subq_10.view__ds_partitioned__extract_quarter + , subq_10.view__ds_partitioned__extract_month + , subq_10.view__ds_partitioned__extract_week + , subq_10.view__ds_partitioned__extract_day + , subq_10.view__ds_partitioned__extract_dayofweek + , subq_10.view__ds_partitioned__extract_dayofyear , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month @@ -330,21 +498,49 @@ FROM ( , DATE_TRUNC(views_source_src_10009.ds, month) AS ds__month , DATE_TRUNC(views_source_src_10009.ds, quarter) AS ds__quarter , DATE_TRUNC(views_source_src_10009.ds, year) AS ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(views_source_src_10009.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(views_source_src_10009.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(views_source_src_10009.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(views_source_src_10009.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofyear , views_source_src_10009.ds AS view__ds__day , DATE_TRUNC(views_source_src_10009.ds, isoweek) AS view__ds__week , DATE_TRUNC(views_source_src_10009.ds, month) AS view__ds__month , DATE_TRUNC(views_source_src_10009.ds, quarter) AS view__ds__quarter , DATE_TRUNC(views_source_src_10009.ds, year) AS view__ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS view__ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS view__ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS view__ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS view__ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS view__ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS view__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS view__ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS view__ds_partitioned__day , DATE_TRUNC(views_source_src_10009.ds_partitioned, isoweek) AS view__ds_partitioned__week , DATE_TRUNC(views_source_src_10009.ds_partitioned, month) AS view__ds_partitioned__month , DATE_TRUNC(views_source_src_10009.ds_partitioned, quarter) AS view__ds_partitioned__quarter , DATE_TRUNC(views_source_src_10009.ds_partitioned, year) AS view__ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofyear , views_source_src_10009.listing_id AS listing , views_source_src_10009.user_id AS user , views_source_src_10009.listing_id AS view__listing @@ -367,21 +563,49 @@ FROM ( , subq_13.ds__month , subq_13.ds__quarter , subq_13.ds__year + , subq_13.ds__extract_year + , subq_13.ds__extract_quarter + , subq_13.ds__extract_month + , subq_13.ds__extract_week + , subq_13.ds__extract_day + , subq_13.ds__extract_dayofweek + , subq_13.ds__extract_dayofyear , subq_13.created_at__day , subq_13.created_at__week , subq_13.created_at__month , subq_13.created_at__quarter , subq_13.created_at__year + , subq_13.created_at__extract_year + , subq_13.created_at__extract_quarter + , subq_13.created_at__extract_month + , subq_13.created_at__extract_week + , subq_13.created_at__extract_day + , subq_13.created_at__extract_dayofweek + , subq_13.created_at__extract_dayofyear , subq_13.listing__ds__day , subq_13.listing__ds__week , subq_13.listing__ds__month , subq_13.listing__ds__quarter , subq_13.listing__ds__year + , subq_13.listing__ds__extract_year + , subq_13.listing__ds__extract_quarter + , subq_13.listing__ds__extract_month + , subq_13.listing__ds__extract_week + , subq_13.listing__ds__extract_day + , subq_13.listing__ds__extract_dayofweek + , subq_13.listing__ds__extract_dayofyear , subq_13.listing__created_at__day , subq_13.listing__created_at__week , subq_13.listing__created_at__month , subq_13.listing__created_at__quarter , subq_13.listing__created_at__year + , subq_13.listing__created_at__extract_year + , subq_13.listing__created_at__extract_quarter + , subq_13.listing__created_at__extract_month + , subq_13.listing__created_at__extract_week + , subq_13.listing__created_at__extract_day + , subq_13.listing__created_at__extract_dayofweek + , subq_13.listing__created_at__extract_dayofyear , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month @@ -410,11 +634,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -423,11 +661,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index 08bfd58be5..7bf9d04ee5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -47,32 +47,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -99,11 +141,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -112,11 +168,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql index d6a8efaf58..2064e8d4a5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql index 81a62360fc..b2502ec83f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql @@ -38,32 +38,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql index 933fb9ceb6..932baf10dc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC(revenue_src_10006.created_at, month) AS ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS company__ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql index 94b6d6bce9..3ed483e9d4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC(revenue_src_10006.created_at, month) AS ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS company__ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql index 2ff6721ee1..0f802052ea 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql @@ -18,11 +18,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -40,11 +54,25 @@ FROM ( , DATE_TRUNC(revenue_src_10006.created_at, month) AS ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS company__ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql index 1aea8e979f..1f5785cdff 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC(revenue_src_10006.created_at, month) AS ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS company__ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index 1421d2e6bd..6f77ab2cfe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC(revenue_src_10006.created_at, month) AS ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS company__ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql index b0f1599a3b..b53f5ed26c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC(revenue_src_10006.created_at, month) AS ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month , DATE_TRUNC(revenue_src_10006.created_at, quarter) AS company__ds__quarter , DATE_TRUNC(revenue_src_10006.created_at, year) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql index 2509b4af2a..6c4ce49599 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -170,31 +254,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -244,32 +370,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql index 8aecbdf2d9..56f97cc21c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 209adca784..a501f2c21b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql index 344a6f8a7e..64b240f7de 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 4d7ae69b40..706834fa9c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index fc94b13135..65759f67e7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -235,31 +361,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,31 +463,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -369,32 +579,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index b35514eac0..12e3863ba1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -236,31 +362,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,31 +464,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -370,32 +580,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql index 69c82a8daa..77bb8bd9ad 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_4.ds__month AS ds__month , subq_4.ds__quarter AS ds__quarter , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_week AS ds__extract_week + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_4.ds__extract_dayofyear AS ds__extract_dayofyear , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , subq_4.ds_partitioned__year AS ds_partitioned__year + , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_4.paid_at__day AS paid_at__day , subq_4.paid_at__week AS paid_at__week , subq_4.paid_at__month AS paid_at__month , subq_4.paid_at__quarter AS paid_at__quarter , subq_4.paid_at__year AS paid_at__year + , subq_4.paid_at__extract_year AS paid_at__extract_year + , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_4.paid_at__extract_month AS paid_at__extract_month + , subq_4.paid_at__extract_week AS paid_at__extract_week + , subq_4.paid_at__extract_day AS paid_at__extract_day + , subq_4.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_4.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_4.booking__ds__day AS booking__ds__day , subq_4.booking__ds__week AS booking__ds__week , subq_4.booking__ds__month AS booking__ds__month , subq_4.booking__ds__quarter AS booking__ds__quarter , subq_4.booking__ds__year AS booking__ds__year + , subq_4.booking__ds__extract_year AS booking__ds__extract_year + , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_4.booking__ds__extract_month AS booking__ds__extract_month + , subq_4.booking__ds__extract_week AS booking__ds__extract_week + , subq_4.booking__ds__extract_day AS booking__ds__extract_day + , subq_4.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_4.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_4.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_4.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_4.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_4.booking__paid_at__day AS booking__paid_at__day , subq_4.booking__paid_at__week AS booking__paid_at__week , subq_4.booking__paid_at__month AS booking__paid_at__month , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter , subq_4.booking__paid_at__year AS booking__paid_at__year + , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_4.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_4.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_4.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,31 +130,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , 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 @@ -152,31 +236,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -226,32 +352,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql index 0611cb68f9..7636cc1e70 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,31 +129,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -161,32 +245,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql index c425f193ff..58dc1a7753 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql @@ -42,31 +42,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -116,32 +158,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -166,21 +250,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -209,11 +321,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -222,11 +348,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql index 54339676f9..275f765347 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql @@ -25,32 +25,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql index 8bf2f905ba..4f0cd51ead 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql index 84967d17b8..eac727a04f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -48,31 +48,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -122,32 +164,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -172,21 +256,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -215,11 +327,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -228,11 +354,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql index 3e4b26294d..42992d6e00 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql @@ -30,8 +30,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_4.window_start__day AS listing__window_start__day - , subq_4.window_end__day AS listing__window_end__day + , subq_4.window_start__extract_year AS listing__window_start__extract_year + , subq_4.window_end__extract_month AS listing__window_end__extract_month , subq_2.listing AS listing , subq_4.capacity AS listing__capacity , subq_2.bookings AS bookings @@ -50,31 +50,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -110,32 +152,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10015.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10015.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10015.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10015.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10015.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10015.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10015.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10015.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10015.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10015.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10015.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -152,8 +236,8 @@ FROM ( -- Pass Only Elements: -- ['capacity', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_3.window_start__day - , subq_3.window_end__day + subq_3.window_start__extract_year + , subq_3.window_end__extract_month , subq_3.listing , subq_3.capacity FROM ( @@ -164,11 +248,25 @@ FROM ( , DATE_TRUNC(listings_src_10017.active_from, month) AS window_start__month , DATE_TRUNC(listings_src_10017.active_from, quarter) AS window_start__quarter , DATE_TRUNC(listings_src_10017.active_from, year) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS window_end__month , DATE_TRUNC(listings_src_10017.active_to, quarter) AS window_end__quarter , DATE_TRUNC(listings_src_10017.active_to, year) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +275,25 @@ FROM ( , DATE_TRUNC(listings_src_10017.active_from, month) AS listing__window_start__month , DATE_TRUNC(listings_src_10017.active_from, quarter) AS listing__window_start__quarter , DATE_TRUNC(listings_src_10017.active_from, year) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS listing__window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS listing__window_end__month , DATE_TRUNC(listings_src_10017.active_to, quarter) AS listing__window_end__quarter , DATE_TRUNC(listings_src_10017.active_to, year) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -196,12 +308,12 @@ FROM ( subq_2.listing = subq_4.listing ) AND ( ( - subq_2.metric_time__day >= subq_4.window_start__day + subq_2.metric_time__day >= subq_4.window_start__extract_year ) AND ( ( - subq_2.metric_time__day < subq_4.window_end__day + subq_2.metric_time__day < subq_4.window_end__extract_month ) OR ( - subq_4.window_end__day IS NULL + subq_4.window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql index 86a2010b35..67cb3e3673 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0_optimized.sql @@ -32,12 +32,12 @@ FROM ( subq_12.listing = listings_src_10017.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10017.active_from + subq_12.metric_time__day >= EXTRACT(YEAR FROM listings_src_10017.active_from) ) AND ( ( - subq_12.metric_time__day < listings_src_10017.active_to + subq_12.metric_time__day < EXTRACT(MONTH FROM listings_src_10017.active_to) ) OR ( - listings_src_10017.active_to IS NULL + EXTRACT(MONTH FROM listings_src_10017.active_to) IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 596f7bc63d..c5d9e328b3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql index 57d8f2dd86..31b984a461 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql index 4bfa0a7160..e346d4997e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql index 76460a6549..e02fa3f09c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql @@ -26,31 +26,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql index 62281ada3f..ee95464b60 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql @@ -21,21 +21,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.created_at__day , subq_0.created_at__week , subq_0.created_at__month , subq_0.created_at__quarter , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_week + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dayofweek + , subq_0.created_at__extract_dayofyear , subq_0.listing__ds__day , subq_0.listing__ds__week , subq_0.listing__ds__month , subq_0.listing__ds__quarter , subq_0.listing__ds__year + , subq_0.listing__ds__extract_year + , subq_0.listing__ds__extract_quarter + , subq_0.listing__ds__extract_month + , subq_0.listing__ds__extract_week + , subq_0.listing__ds__extract_day + , subq_0.listing__ds__extract_dayofweek + , subq_0.listing__ds__extract_dayofyear , subq_0.listing__created_at__day , subq_0.listing__created_at__week , subq_0.listing__created_at__month , subq_0.listing__created_at__quarter , subq_0.listing__created_at__year + , subq_0.listing__created_at__extract_year + , subq_0.listing__created_at__extract_quarter + , subq_0.listing__created_at__extract_month + , subq_0.listing__created_at__extract_week + , subq_0.listing__created_at__extract_day + , subq_0.listing__created_at__extract_dayofweek + , subq_0.listing__created_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -77,11 +119,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql index 6b1d66f727..db653ee51c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql @@ -35,32 +35,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql index 32e4f04bb3..6385db4297 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql @@ -60,31 +60,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -134,32 +176,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -184,21 +268,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -227,11 +339,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -240,11 +366,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -317,31 +457,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -391,32 +573,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -441,21 +665,49 @@ FROM ( , subq_15.ds__month , subq_15.ds__quarter , subq_15.ds__year + , subq_15.ds__extract_year + , subq_15.ds__extract_quarter + , subq_15.ds__extract_month + , subq_15.ds__extract_week + , subq_15.ds__extract_day + , subq_15.ds__extract_dayofweek + , subq_15.ds__extract_dayofyear , subq_15.created_at__day , subq_15.created_at__week , subq_15.created_at__month , subq_15.created_at__quarter , subq_15.created_at__year + , subq_15.created_at__extract_year + , subq_15.created_at__extract_quarter + , subq_15.created_at__extract_month + , subq_15.created_at__extract_week + , subq_15.created_at__extract_day + , subq_15.created_at__extract_dayofweek + , subq_15.created_at__extract_dayofyear , subq_15.listing__ds__day , subq_15.listing__ds__week , subq_15.listing__ds__month , subq_15.listing__ds__quarter , subq_15.listing__ds__year + , subq_15.listing__ds__extract_year + , subq_15.listing__ds__extract_quarter + , subq_15.listing__ds__extract_month + , subq_15.listing__ds__extract_week + , subq_15.listing__ds__extract_day + , subq_15.listing__ds__extract_dayofweek + , subq_15.listing__ds__extract_dayofyear , subq_15.listing__created_at__day , subq_15.listing__created_at__week , subq_15.listing__created_at__month , subq_15.listing__created_at__quarter , subq_15.listing__created_at__year + , subq_15.listing__created_at__extract_year + , subq_15.listing__created_at__extract_quarter + , subq_15.listing__created_at__extract_month + , subq_15.listing__created_at__extract_week + , subq_15.listing__created_at__extract_day + , subq_15.listing__created_at__extract_dayofweek + , subq_15.listing__created_at__extract_dayofyear , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month @@ -484,11 +736,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -497,11 +763,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -557,31 +837,73 @@ FROM ( , subq_24.ds__month , subq_24.ds__quarter , subq_24.ds__year + , subq_24.ds__extract_year + , subq_24.ds__extract_quarter + , subq_24.ds__extract_month + , subq_24.ds__extract_week + , subq_24.ds__extract_day + , subq_24.ds__extract_dayofweek + , subq_24.ds__extract_dayofyear , subq_24.ds_partitioned__day , subq_24.ds_partitioned__week , subq_24.ds_partitioned__month , subq_24.ds_partitioned__quarter , subq_24.ds_partitioned__year + , subq_24.ds_partitioned__extract_year + , subq_24.ds_partitioned__extract_quarter + , subq_24.ds_partitioned__extract_month + , subq_24.ds_partitioned__extract_week + , subq_24.ds_partitioned__extract_day + , subq_24.ds_partitioned__extract_dayofweek + , subq_24.ds_partitioned__extract_dayofyear , subq_24.paid_at__day , subq_24.paid_at__week , subq_24.paid_at__month , subq_24.paid_at__quarter , subq_24.paid_at__year + , subq_24.paid_at__extract_year + , subq_24.paid_at__extract_quarter + , subq_24.paid_at__extract_month + , subq_24.paid_at__extract_week + , subq_24.paid_at__extract_day + , subq_24.paid_at__extract_dayofweek + , subq_24.paid_at__extract_dayofyear , subq_24.booking__ds__day , subq_24.booking__ds__week , subq_24.booking__ds__month , subq_24.booking__ds__quarter , subq_24.booking__ds__year + , subq_24.booking__ds__extract_year + , subq_24.booking__ds__extract_quarter + , subq_24.booking__ds__extract_month + , subq_24.booking__ds__extract_week + , subq_24.booking__ds__extract_day + , subq_24.booking__ds__extract_dayofweek + , subq_24.booking__ds__extract_dayofyear , subq_24.booking__ds_partitioned__day , subq_24.booking__ds_partitioned__week , subq_24.booking__ds_partitioned__month , subq_24.booking__ds_partitioned__quarter , subq_24.booking__ds_partitioned__year + , subq_24.booking__ds_partitioned__extract_year + , subq_24.booking__ds_partitioned__extract_quarter + , subq_24.booking__ds_partitioned__extract_month + , subq_24.booking__ds_partitioned__extract_week + , subq_24.booking__ds_partitioned__extract_day + , subq_24.booking__ds_partitioned__extract_dayofweek + , subq_24.booking__ds_partitioned__extract_dayofyear , subq_24.booking__paid_at__day , subq_24.booking__paid_at__week , subq_24.booking__paid_at__month , subq_24.booking__paid_at__quarter , subq_24.booking__paid_at__year + , subq_24.booking__paid_at__extract_year + , subq_24.booking__paid_at__extract_quarter + , subq_24.booking__paid_at__extract_month + , subq_24.booking__paid_at__extract_week + , subq_24.booking__paid_at__extract_day + , subq_24.booking__paid_at__extract_dayofweek + , subq_24.booking__paid_at__extract_dayofyear , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month @@ -631,32 +953,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql index 0574ca1f09..9352ceb3e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql @@ -45,31 +45,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -119,32 +161,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -186,31 +270,73 @@ FROM ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.ds_partitioned__day , subq_7.ds_partitioned__week , subq_7.ds_partitioned__month , subq_7.ds_partitioned__quarter , subq_7.ds_partitioned__year + , subq_7.ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_week + , subq_7.ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dayofweek + , subq_7.ds_partitioned__extract_dayofyear , subq_7.paid_at__day , subq_7.paid_at__week , subq_7.paid_at__month , subq_7.paid_at__quarter , subq_7.paid_at__year + , subq_7.paid_at__extract_year + , subq_7.paid_at__extract_quarter + , subq_7.paid_at__extract_month + , subq_7.paid_at__extract_week + , subq_7.paid_at__extract_day + , subq_7.paid_at__extract_dayofweek + , subq_7.paid_at__extract_dayofyear , subq_7.booking__ds__day , subq_7.booking__ds__week , subq_7.booking__ds__month , subq_7.booking__ds__quarter , subq_7.booking__ds__year + , subq_7.booking__ds__extract_year + , subq_7.booking__ds__extract_quarter + , subq_7.booking__ds__extract_month + , subq_7.booking__ds__extract_week + , subq_7.booking__ds__extract_day + , subq_7.booking__ds__extract_dayofweek + , subq_7.booking__ds__extract_dayofyear , subq_7.booking__ds_partitioned__day , subq_7.booking__ds_partitioned__week , subq_7.booking__ds_partitioned__month , subq_7.booking__ds_partitioned__quarter , subq_7.booking__ds_partitioned__year + , subq_7.booking__ds_partitioned__extract_year + , subq_7.booking__ds_partitioned__extract_quarter + , subq_7.booking__ds_partitioned__extract_month + , subq_7.booking__ds_partitioned__extract_week + , subq_7.booking__ds_partitioned__extract_day + , subq_7.booking__ds_partitioned__extract_dayofweek + , subq_7.booking__ds_partitioned__extract_dayofyear , subq_7.booking__paid_at__day , subq_7.booking__paid_at__week , subq_7.booking__paid_at__month , subq_7.booking__paid_at__quarter , subq_7.booking__paid_at__year + , subq_7.booking__paid_at__extract_year + , subq_7.booking__paid_at__extract_quarter + , subq_7.booking__paid_at__extract_month + , subq_7.booking__paid_at__extract_week + , subq_7.booking__paid_at__extract_day + , subq_7.booking__paid_at__extract_dayofweek + , subq_7.booking__paid_at__extract_dayofyear , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month @@ -260,32 +386,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql index b05ffb6c76..f40149ee65 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -39,31 +39,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -113,32 +155,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 906d227e1d..8c59fd497e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -160,21 +244,49 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.created_at__day , subq_5.created_at__week , subq_5.created_at__month , subq_5.created_at__quarter , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_week + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dayofweek + , subq_5.created_at__extract_dayofyear , subq_5.listing__ds__day , subq_5.listing__ds__week , subq_5.listing__ds__month , subq_5.listing__ds__quarter , subq_5.listing__ds__year + , subq_5.listing__ds__extract_year + , subq_5.listing__ds__extract_quarter + , subq_5.listing__ds__extract_month + , subq_5.listing__ds__extract_week + , subq_5.listing__ds__extract_day + , subq_5.listing__ds__extract_dayofweek + , subq_5.listing__ds__extract_dayofyear , subq_5.listing__created_at__day , subq_5.listing__created_at__week , subq_5.listing__created_at__month , subq_5.listing__created_at__quarter , subq_5.listing__created_at__year + , subq_5.listing__created_at__extract_year + , subq_5.listing__created_at__extract_quarter + , subq_5.listing__created_at__extract_month + , subq_5.listing__created_at__extract_week + , subq_5.listing__created_at__extract_day + , subq_5.listing__created_at__extract_dayofweek + , subq_5.listing__created_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -203,11 +315,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -216,11 +342,25 @@ FROM ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql index d39a0a23d5..6768aa1e85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.window_start__day AS listing__window_start__day - , subq_7.window_end__day AS listing__window_end__day + , subq_7.window_start__extract_year AS listing__window_start__extract_year + , subq_7.window_end__extract_month AS listing__window_end__extract_month , subq_2.listing AS listing , subq_7.user__home_state_latest AS listing__user__home_state_latest , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10015.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10015.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10015.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10015.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10015.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10015.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10015.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10015.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10015.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10015.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10015.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -142,8 +226,8 @@ FROM ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_6.window_start__day - , subq_6.window_end__day + subq_6.window_start__extract_year + , subq_6.window_end__extract_month , subq_6.listing , subq_6.user__home_state_latest FROM ( @@ -154,26 +238,61 @@ FROM ( , subq_3.window_start__month AS window_start__month , subq_3.window_start__quarter AS window_start__quarter , subq_3.window_start__year AS window_start__year + , subq_3.window_start__extract_year AS window_start__extract_year + , subq_3.window_start__extract_quarter AS window_start__extract_quarter + , subq_3.window_start__extract_month AS window_start__extract_month + , subq_3.window_start__extract_week AS window_start__extract_week + , subq_3.window_start__extract_day AS window_start__extract_day + , subq_3.window_start__extract_dayofweek AS window_start__extract_dayofweek + , subq_3.window_start__extract_dayofyear AS window_start__extract_dayofyear , subq_3.window_end__day AS window_end__day , subq_3.window_end__week AS window_end__week , subq_3.window_end__month AS window_end__month , subq_3.window_end__quarter AS window_end__quarter , subq_3.window_end__year AS window_end__year + , subq_3.window_end__extract_year AS window_end__extract_year + , subq_3.window_end__extract_quarter AS window_end__extract_quarter + , subq_3.window_end__extract_month AS window_end__extract_month + , subq_3.window_end__extract_week AS window_end__extract_week + , subq_3.window_end__extract_day AS window_end__extract_day + , subq_3.window_end__extract_dayofweek AS window_end__extract_dayofweek + , subq_3.window_end__extract_dayofyear AS window_end__extract_dayofyear , subq_3.listing__window_start__day AS listing__window_start__day , subq_3.listing__window_start__week AS listing__window_start__week , subq_3.listing__window_start__month AS listing__window_start__month , subq_3.listing__window_start__quarter AS listing__window_start__quarter , subq_3.listing__window_start__year AS listing__window_start__year + , subq_3.listing__window_start__extract_year AS listing__window_start__extract_year + , subq_3.listing__window_start__extract_quarter AS listing__window_start__extract_quarter + , subq_3.listing__window_start__extract_month AS listing__window_start__extract_month + , subq_3.listing__window_start__extract_week AS listing__window_start__extract_week + , subq_3.listing__window_start__extract_day AS listing__window_start__extract_day + , subq_3.listing__window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_3.listing__window_start__extract_dayofyear AS listing__window_start__extract_dayofyear , subq_3.listing__window_end__day AS listing__window_end__day , subq_3.listing__window_end__week AS listing__window_end__week , subq_3.listing__window_end__month AS listing__window_end__month , subq_3.listing__window_end__quarter AS listing__window_end__quarter , subq_3.listing__window_end__year AS listing__window_end__year + , subq_3.listing__window_end__extract_year AS listing__window_end__extract_year + , subq_3.listing__window_end__extract_quarter AS listing__window_end__extract_quarter + , subq_3.listing__window_end__extract_month AS listing__window_end__extract_month + , subq_3.listing__window_end__extract_week AS listing__window_end__extract_week + , subq_3.listing__window_end__extract_day AS listing__window_end__extract_day + , subq_3.listing__window_end__extract_dayofweek AS listing__window_end__extract_dayofweek + , subq_3.listing__window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dayofweek AS user__ds__extract_dayofweek + , subq_5.ds__extract_dayofyear AS user__ds__extract_dayofyear , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +311,25 @@ FROM ( , DATE_TRUNC(listings_src_10017.active_from, month) AS window_start__month , DATE_TRUNC(listings_src_10017.active_from, quarter) AS window_start__quarter , DATE_TRUNC(listings_src_10017.active_from, year) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS window_end__month , DATE_TRUNC(listings_src_10017.active_to, quarter) AS window_end__quarter , DATE_TRUNC(listings_src_10017.active_to, year) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +338,25 @@ FROM ( , DATE_TRUNC(listings_src_10017.active_from, month) AS listing__window_start__month , DATE_TRUNC(listings_src_10017.active_from, quarter) AS listing__window_start__quarter , DATE_TRUNC(listings_src_10017.active_from, year) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS listing__window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS listing__window_end__month , DATE_TRUNC(listings_src_10017.active_to, quarter) AS listing__window_end__quarter , DATE_TRUNC(listings_src_10017.active_to, year) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -227,11 +374,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +400,25 @@ FROM ( , subq_4.ds__month , subq_4.ds__quarter , subq_4.ds__year + , subq_4.ds__extract_year + , subq_4.ds__extract_quarter + , subq_4.ds__extract_month + , subq_4.ds__extract_week + , subq_4.ds__extract_day + , subq_4.ds__extract_dayofweek + , subq_4.ds__extract_dayofyear , subq_4.user__ds__day , subq_4.user__ds__week , subq_4.user__ds__month , subq_4.user__ds__quarter , subq_4.user__ds__year + , subq_4.user__ds__extract_year + , subq_4.user__ds__extract_quarter + , subq_4.user__ds__extract_month + , subq_4.user__ds__extract_week + , subq_4.user__ds__extract_day + , subq_4.user__ds__extract_dayofweek + , subq_4.user__ds__extract_dayofyear , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +430,26 @@ FROM ( , DATE_TRUNC(users_latest_src_10021.ds, month) AS ds__month , DATE_TRUNC(users_latest_src_10021.ds, quarter) AS ds__quarter , DATE_TRUNC(users_latest_src_10021.ds, year) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS ds__extract_dayofyear , users_latest_src_10021.home_state_latest , users_latest_src_10021.ds AS user__ds__day , DATE_TRUNC(users_latest_src_10021.ds, isoweek) AS user__ds__week , DATE_TRUNC(users_latest_src_10021.ds, month) AS user__ds__month , DATE_TRUNC(users_latest_src_10021.ds, quarter) AS user__ds__quarter , DATE_TRUNC(users_latest_src_10021.ds, year) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS user__ds__extract_dayofyear , users_latest_src_10021.home_state_latest AS user__home_state_latest , users_latest_src_10021.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10021 @@ -275,12 +464,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.window_start__day + subq_2.metric_time__day >= subq_7.window_start__extract_year ) AND ( ( - subq_2.metric_time__day < subq_7.window_end__day + subq_2.metric_time__day < subq_7.window_end__extract_month ) OR ( - subq_7.window_end__day IS NULL + subq_7.window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql index e8abbb3f87..982dc76a00 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -23,8 +23,8 @@ LEFT OUTER JOIN ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10017.active_from AS window_start__day - , listings_src_10017.active_to AS window_end__day + EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month , listings_src_10017.listing_id AS listing , users_latest_src_10021.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings listings_src_10017 @@ -38,12 +38,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.window_start__day + subq_13.metric_time__day >= subq_18.window_start__extract_year ) AND ( ( - subq_13.metric_time__day < subq_18.window_end__day + subq_13.metric_time__day < subq_18.window_end__extract_month ) OR ( - subq_18.window_end__day IS NULL + subq_18.window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql index 810e69a1cf..c90d262566 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.lux_listing__window_start__day AS listing__lux_listing__window_start__day - , subq_7.lux_listing__window_end__day AS listing__lux_listing__window_end__day + , subq_7.lux_listing__window_start__extract_month AS listing__lux_listing__window_start__extract_month + , subq_7.lux_listing__window_end__extract_year AS listing__lux_listing__window_end__extract_year , subq_2.listing AS listing , subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10015.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10015.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10015.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10015.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10015.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10015.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10015.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10015.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10015.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10015.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10015.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -145,8 +229,8 @@ FROM ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - subq_6.lux_listing__window_start__day - , subq_6.lux_listing__window_end__day + subq_6.lux_listing__window_start__extract_month + , subq_6.lux_listing__window_end__extract_year , subq_6.listing , subq_6.lux_listing__is_confirmed_lux FROM ( @@ -157,11 +241,25 @@ FROM ( , subq_5.window_start__month AS lux_listing__window_start__month , subq_5.window_start__quarter AS lux_listing__window_start__quarter , subq_5.window_start__year AS lux_listing__window_start__year + , subq_5.window_start__extract_year AS lux_listing__window_start__extract_year + , subq_5.window_start__extract_quarter AS lux_listing__window_start__extract_quarter + , subq_5.window_start__extract_month AS lux_listing__window_start__extract_month + , subq_5.window_start__extract_week AS lux_listing__window_start__extract_week + , subq_5.window_start__extract_day AS lux_listing__window_start__extract_day + , subq_5.window_start__extract_dayofweek AS lux_listing__window_start__extract_dayofweek + , subq_5.window_start__extract_dayofyear AS lux_listing__window_start__extract_dayofyear , subq_5.window_end__day AS lux_listing__window_end__day , subq_5.window_end__week AS lux_listing__window_end__week , subq_5.window_end__month AS lux_listing__window_end__month , subq_5.window_end__quarter AS lux_listing__window_end__quarter , subq_5.window_end__year AS lux_listing__window_end__year + , subq_5.window_end__extract_year AS lux_listing__window_end__extract_year + , subq_5.window_end__extract_quarter AS lux_listing__window_end__extract_quarter + , subq_5.window_end__extract_month AS lux_listing__window_end__extract_month + , subq_5.window_end__extract_week AS lux_listing__window_end__extract_week + , subq_5.window_end__extract_day AS lux_listing__window_end__extract_day + , subq_5.window_end__extract_dayofweek AS lux_listing__window_end__extract_dayofweek + , subq_5.window_end__extract_dayofyear AS lux_listing__window_end__extract_dayofyear , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +281,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +331,49 @@ FROM ( , subq_4.window_start__month , subq_4.window_start__quarter , subq_4.window_start__year + , subq_4.window_start__extract_year + , subq_4.window_start__extract_quarter + , subq_4.window_start__extract_month + , subq_4.window_start__extract_week + , subq_4.window_start__extract_day + , subq_4.window_start__extract_dayofweek + , subq_4.window_start__extract_dayofyear , subq_4.window_end__day , subq_4.window_end__week , subq_4.window_end__month , subq_4.window_end__quarter , subq_4.window_end__year + , subq_4.window_end__extract_year + , subq_4.window_end__extract_quarter + , subq_4.window_end__extract_month + , subq_4.window_end__extract_week + , subq_4.window_end__extract_day + , subq_4.window_end__extract_dayofweek + , subq_4.window_end__extract_dayofyear , subq_4.lux_listing__window_start__day , subq_4.lux_listing__window_start__week , subq_4.lux_listing__window_start__month , subq_4.lux_listing__window_start__quarter , subq_4.lux_listing__window_start__year + , subq_4.lux_listing__window_start__extract_year + , subq_4.lux_listing__window_start__extract_quarter + , subq_4.lux_listing__window_start__extract_month + , subq_4.lux_listing__window_start__extract_week + , subq_4.lux_listing__window_start__extract_day + , subq_4.lux_listing__window_start__extract_dayofweek + , subq_4.lux_listing__window_start__extract_dayofyear , subq_4.lux_listing__window_end__day , subq_4.lux_listing__window_end__week , subq_4.lux_listing__window_end__month , subq_4.lux_listing__window_end__quarter , subq_4.lux_listing__window_end__year + , subq_4.lux_listing__window_end__extract_year + , subq_4.lux_listing__window_end__extract_quarter + , subq_4.lux_listing__window_end__extract_month + , subq_4.lux_listing__window_end__extract_week + , subq_4.lux_listing__window_end__extract_day + , subq_4.lux_listing__window_end__extract_dayofweek + , subq_4.lux_listing__window_end__extract_dayofyear , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +385,50 @@ FROM ( , DATE_TRUNC(lux_listings_src_10019.valid_from, month) AS window_start__month , DATE_TRUNC(lux_listings_src_10019.valid_from, quarter) AS window_start__quarter , DATE_TRUNC(lux_listings_src_10019.valid_from, year) AS window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS window_end__day , DATE_TRUNC(lux_listings_src_10019.valid_to, isoweek) AS window_end__week , DATE_TRUNC(lux_listings_src_10019.valid_to, month) AS window_end__month , DATE_TRUNC(lux_listings_src_10019.valid_to, quarter) AS window_end__quarter , DATE_TRUNC(lux_listings_src_10019.valid_to, year) AS window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux , lux_listings_src_10019.valid_from AS lux_listing__window_start__day , DATE_TRUNC(lux_listings_src_10019.valid_from, isoweek) AS lux_listing__window_start__week , DATE_TRUNC(lux_listings_src_10019.valid_from, month) AS lux_listing__window_start__month , DATE_TRUNC(lux_listings_src_10019.valid_from, quarter) AS lux_listing__window_start__quarter , DATE_TRUNC(lux_listings_src_10019.valid_from, year) AS lux_listing__window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS lux_listing__window_end__day , DATE_TRUNC(lux_listings_src_10019.valid_to, isoweek) AS lux_listing__window_end__week , DATE_TRUNC(lux_listings_src_10019.valid_to, month) AS lux_listing__window_end__month , DATE_TRUNC(lux_listings_src_10019.valid_to, quarter) AS lux_listing__window_end__quarter , DATE_TRUNC(lux_listings_src_10019.valid_to, year) AS lux_listing__window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux , lux_listings_src_10019.lux_listing_id AS lux_listing FROM ***************************.dim_lux_listings lux_listings_src_10019 @@ -261,12 +443,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.lux_listing__window_start__day + subq_2.metric_time__day >= subq_7.lux_listing__window_start__extract_month ) AND ( ( - subq_2.metric_time__day < subq_7.lux_listing__window_end__day + subq_2.metric_time__day < subq_7.lux_listing__window_end__extract_year ) OR ( - subq_7.lux_listing__window_end__day IS NULL + subq_7.lux_listing__window_end__extract_year IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql index 415ccb8d00..624c143c97 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -26,8 +26,8 @@ LEFT OUTER JOIN ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - lux_listings_src_10019.valid_from AS lux_listing__window_start__day - , lux_listings_src_10019.valid_to AS lux_listing__window_end__day + EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year , lux_listing_mapping_src_10018.listing_id AS listing , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10018 @@ -41,12 +41,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.lux_listing__window_start__day + subq_13.metric_time__day >= subq_18.lux_listing__window_start__extract_month ) AND ( ( - subq_13.metric_time__day < subq_18.lux_listing__window_end__day + subq_13.metric_time__day < subq_18.lux_listing__window_end__extract_year ) OR ( - subq_18.lux_listing__window_end__day IS NULL + subq_18.lux_listing__window_end__extract_year IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql index 03d53212bd..9c13f10eec 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql @@ -33,32 +33,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -85,11 +127,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -98,11 +154,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -131,11 +201,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -144,11 +228,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql index 96381bbd71..28e5abd86f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.ds__day , subq_0.ds__week , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.account_id__ds_partitioned__day , subq_0.account_id__ds_partitioned__week , subq_0.account_id__ds_partitioned__month , subq_0.account_id__ds_partitioned__quarter , subq_0.account_id__ds_partitioned__year + , subq_0.account_id__ds_partitioned__extract_year + , subq_0.account_id__ds_partitioned__extract_quarter + , subq_0.account_id__ds_partitioned__extract_month + , subq_0.account_id__ds_partitioned__extract_week + , subq_0.account_id__ds_partitioned__extract_day + , subq_0.account_id__ds_partitioned__extract_dayofweek + , subq_0.account_id__ds_partitioned__extract_dayofyear , subq_0.account_id__ds__day , subq_0.account_id__ds__week , subq_0.account_id__ds__month , subq_0.account_id__ds__quarter , subq_0.account_id__ds__year + , subq_0.account_id__ds__extract_year + , subq_0.account_id__ds__extract_quarter + , subq_0.account_id__ds__extract_month + , subq_0.account_id__ds__extract_week + , subq_0.account_id__ds__extract_day + , subq_0.account_id__ds__extract_dayofweek + , subq_0.account_id__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -69,22 +97,50 @@ FROM ( , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS ds__day , DATE_TRUNC(account_month_txns_src_10010.ds, isoweek) AS ds__week , DATE_TRUNC(account_month_txns_src_10010.ds, month) AS ds__month , DATE_TRUNC(account_month_txns_src_10010.ds, quarter) AS ds__quarter , DATE_TRUNC(account_month_txns_src_10010.ds, year) AS ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS ds__extract_dayofyear , account_month_txns_src_10010.account_month , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, isoweek) AS account_id__ds_partitioned__week , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, month) AS account_id__ds_partitioned__month , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, year) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS account_id__ds__day , DATE_TRUNC(account_month_txns_src_10010.ds, isoweek) AS account_id__ds__week , DATE_TRUNC(account_month_txns_src_10010.ds, month) AS account_id__ds__month , DATE_TRUNC(account_month_txns_src_10010.ds, quarter) AS account_id__ds__quarter , DATE_TRUNC(account_month_txns_src_10010.ds, year) AS account_id__ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofyear , account_month_txns_src_10010.account_month AS account_id__account_month , account_month_txns_src_10010.account_id FROM ***************************.account_month_txns account_month_txns_src_10010 @@ -106,16 +162,37 @@ FROM ( , subq_3.ds_partitioned__month AS ds_partitioned__month , subq_3.ds_partitioned__quarter AS ds_partitioned__quarter , subq_3.ds_partitioned__year AS ds_partitioned__year + , subq_3.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_3.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_3.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_3.account_id__ds_partitioned__day AS account_id__ds_partitioned__day , subq_3.account_id__ds_partitioned__week AS account_id__ds_partitioned__week , subq_3.account_id__ds_partitioned__month AS account_id__ds_partitioned__month , subq_3.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter , subq_3.account_id__ds_partitioned__year AS account_id__ds_partitioned__year + , subq_3.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year + , subq_3.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter + , subq_3.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month + , subq_3.account_id__ds_partitioned__extract_week AS account_id__ds_partitioned__extract_week + , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day + , subq_3.account_id__ds_partitioned__extract_dayofweek AS account_id__ds_partitioned__extract_dayofweek + , subq_3.account_id__ds_partitioned__extract_dayofyear AS account_id__ds_partitioned__extract_dayofyear , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month , subq_5.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter , subq_5.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_5.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week AS customer_id__ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek AS customer_id__ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear AS customer_id__ds_partitioned__extract_dayofyear , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id @@ -132,12 +209,26 @@ FROM ( , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofyear , bridge_table_src_10011.extra_dim AS account_id__extra_dim , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, isoweek) AS account_id__ds_partitioned__week , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, month) AS account_id__ds_partitioned__month , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, year) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id @@ -154,11 +245,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +271,25 @@ FROM ( , subq_4.ds_partitioned__month , subq_4.ds_partitioned__quarter , subq_4.ds_partitioned__year + , subq_4.ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear , subq_4.customer_id__ds_partitioned__day , subq_4.customer_id__ds_partitioned__week , subq_4.customer_id__ds_partitioned__month , subq_4.customer_id__ds_partitioned__quarter , subq_4.customer_id__ds_partitioned__year + , subq_4.customer_id__ds_partitioned__extract_year + , subq_4.customer_id__ds_partitioned__extract_quarter + , subq_4.customer_id__ds_partitioned__extract_month + , subq_4.customer_id__ds_partitioned__extract_week + , subq_4.customer_id__ds_partitioned__extract_day + , subq_4.customer_id__ds_partitioned__extract_dayofweek + , subq_4.customer_id__ds_partitioned__extract_dayofyear , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +305,13 @@ FROM ( , DATE_TRUNC(customer_table_src_10013.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(customer_table_src_10013.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(customer_table_src_10013.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_name AS customer_id__customer_name , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned__day @@ -193,6 +319,13 @@ FROM ( , DATE_TRUNC(customer_table_src_10013.ds_partitioned, month) AS customer_id__ds_partitioned__month , DATE_TRUNC(customer_table_src_10013.ds_partitioned, quarter) AS customer_id__ds_partitioned__quarter , DATE_TRUNC(customer_table_src_10013.ds_partitioned, year) AS customer_id__ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_id FROM ***************************.customer_table customer_table_src_10013 ) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql index 123b3e721a..696514d415 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql @@ -23,31 +23,73 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.ds_partitioned__day , subq_1.ds_partitioned__week , subq_1.ds_partitioned__month , subq_1.ds_partitioned__quarter , subq_1.ds_partitioned__year + , subq_1.ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear , subq_1.paid_at__day , subq_1.paid_at__week , subq_1.paid_at__month , subq_1.paid_at__quarter , subq_1.paid_at__year + , subq_1.paid_at__extract_year + , subq_1.paid_at__extract_quarter + , subq_1.paid_at__extract_month + , subq_1.paid_at__extract_week + , subq_1.paid_at__extract_day + , subq_1.paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear , subq_1.booking__ds__day , subq_1.booking__ds__week , subq_1.booking__ds__month , subq_1.booking__ds__quarter , subq_1.booking__ds__year + , subq_1.booking__ds__extract_year + , subq_1.booking__ds__extract_quarter + , subq_1.booking__ds__extract_month + , subq_1.booking__ds__extract_week + , subq_1.booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear , subq_1.booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month , subq_1.booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day , subq_1.booking__paid_at__week , subq_1.booking__paid_at__month , subq_1.booking__paid_at__quarter , subq_1.booking__paid_at__year + , subq_1.booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -82,31 +124,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -156,32 +240,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -217,21 +343,49 @@ CROSS JOIN ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.created_at__day , subq_7.created_at__week , subq_7.created_at__month , subq_7.created_at__quarter , subq_7.created_at__year + , subq_7.created_at__extract_year + , subq_7.created_at__extract_quarter + , subq_7.created_at__extract_month + , subq_7.created_at__extract_week + , subq_7.created_at__extract_day + , subq_7.created_at__extract_dayofweek + , subq_7.created_at__extract_dayofyear , subq_7.listing__ds__day , subq_7.listing__ds__week , subq_7.listing__ds__month , subq_7.listing__ds__quarter , subq_7.listing__ds__year + , subq_7.listing__ds__extract_year + , subq_7.listing__ds__extract_quarter + , subq_7.listing__ds__extract_month + , subq_7.listing__ds__extract_week + , subq_7.listing__ds__extract_day + , subq_7.listing__ds__extract_dayofweek + , subq_7.listing__ds__extract_dayofyear , subq_7.listing__created_at__day , subq_7.listing__created_at__week , subq_7.listing__created_at__month , subq_7.listing__created_at__quarter , subq_7.listing__created_at__year + , subq_7.listing__created_at__extract_year + , subq_7.listing__created_at__extract_quarter + , subq_7.listing__created_at__extract_month + , subq_7.listing__created_at__extract_week + , subq_7.listing__created_at__extract_day + , subq_7.listing__created_at__extract_dayofweek + , subq_7.listing__created_at__extract_dayofyear , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month @@ -257,21 +411,49 @@ CROSS JOIN ( , subq_6.ds__month , subq_6.ds__quarter , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_week + , subq_6.ds__extract_day + , subq_6.ds__extract_dayofweek + , subq_6.ds__extract_dayofyear , subq_6.created_at__day , subq_6.created_at__week , subq_6.created_at__month , subq_6.created_at__quarter , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_week + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dayofweek + , subq_6.created_at__extract_dayofyear , subq_6.listing__ds__day , subq_6.listing__ds__week , subq_6.listing__ds__month , subq_6.listing__ds__quarter , subq_6.listing__ds__year + , subq_6.listing__ds__extract_year + , subq_6.listing__ds__extract_quarter + , subq_6.listing__ds__extract_month + , subq_6.listing__ds__extract_week + , subq_6.listing__ds__extract_day + , subq_6.listing__ds__extract_dayofweek + , subq_6.listing__ds__extract_dayofyear , subq_6.listing__created_at__day , subq_6.listing__created_at__week , subq_6.listing__created_at__month , subq_6.listing__created_at__quarter , subq_6.listing__created_at__year + , subq_6.listing__created_at__extract_year + , subq_6.listing__created_at__extract_quarter + , subq_6.listing__created_at__extract_month + , subq_6.listing__created_at__extract_week + , subq_6.listing__created_at__extract_day + , subq_6.listing__created_at__extract_dayofweek + , subq_6.listing__created_at__extract_dayofyear , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month @@ -300,11 +482,25 @@ CROSS JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -313,11 +509,25 @@ CROSS JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql index 3ade4193b3..79e108f49f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql @@ -44,31 +44,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -118,32 +160,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -182,31 +266,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -256,32 +382,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -332,31 +500,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -406,32 +616,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -480,31 +732,73 @@ FROM ( , subq_17.ds__month , subq_17.ds__quarter , subq_17.ds__year + , subq_17.ds__extract_year + , subq_17.ds__extract_quarter + , subq_17.ds__extract_month + , subq_17.ds__extract_week + , subq_17.ds__extract_day + , subq_17.ds__extract_dayofweek + , subq_17.ds__extract_dayofyear , subq_17.ds_partitioned__day , subq_17.ds_partitioned__week , subq_17.ds_partitioned__month , subq_17.ds_partitioned__quarter , subq_17.ds_partitioned__year + , subq_17.ds_partitioned__extract_year + , subq_17.ds_partitioned__extract_quarter + , subq_17.ds_partitioned__extract_month + , subq_17.ds_partitioned__extract_week + , subq_17.ds_partitioned__extract_day + , subq_17.ds_partitioned__extract_dayofweek + , subq_17.ds_partitioned__extract_dayofyear , subq_17.paid_at__day , subq_17.paid_at__week , subq_17.paid_at__month , subq_17.paid_at__quarter , subq_17.paid_at__year + , subq_17.paid_at__extract_year + , subq_17.paid_at__extract_quarter + , subq_17.paid_at__extract_month + , subq_17.paid_at__extract_week + , subq_17.paid_at__extract_day + , subq_17.paid_at__extract_dayofweek + , subq_17.paid_at__extract_dayofyear , subq_17.booking__ds__day , subq_17.booking__ds__week , subq_17.booking__ds__month , subq_17.booking__ds__quarter , subq_17.booking__ds__year + , subq_17.booking__ds__extract_year + , subq_17.booking__ds__extract_quarter + , subq_17.booking__ds__extract_month + , subq_17.booking__ds__extract_week + , subq_17.booking__ds__extract_day + , subq_17.booking__ds__extract_dayofweek + , subq_17.booking__ds__extract_dayofyear , subq_17.booking__ds_partitioned__day , subq_17.booking__ds_partitioned__week , subq_17.booking__ds_partitioned__month , subq_17.booking__ds_partitioned__quarter , subq_17.booking__ds_partitioned__year + , subq_17.booking__ds_partitioned__extract_year + , subq_17.booking__ds_partitioned__extract_quarter + , subq_17.booking__ds_partitioned__extract_month + , subq_17.booking__ds_partitioned__extract_week + , subq_17.booking__ds_partitioned__extract_day + , subq_17.booking__ds_partitioned__extract_dayofweek + , subq_17.booking__ds_partitioned__extract_dayofyear , subq_17.booking__paid_at__day , subq_17.booking__paid_at__week , subq_17.booking__paid_at__month , subq_17.booking__paid_at__quarter , subq_17.booking__paid_at__year + , subq_17.booking__paid_at__extract_year + , subq_17.booking__paid_at__extract_quarter + , subq_17.booking__paid_at__extract_month + , subq_17.booking__paid_at__extract_week + , subq_17.booking__paid_at__extract_day + , subq_17.booking__paid_at__extract_dayofweek + , subq_17.booking__paid_at__extract_dayofyear , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month @@ -554,32 +848,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql index 508c33253e..6fe53f5780 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql @@ -45,32 +45,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql index c27cc36a57..e04b6506be 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.verification__ds__day , subq_0.verification__ds__week , subq_0.verification__ds__month , subq_0.verification__ds__quarter , subq_0.verification__ds__year + , subq_0.verification__ds__extract_year + , subq_0.verification__ds__extract_quarter + , subq_0.verification__ds__extract_month + , subq_0.verification__ds__extract_week + , subq_0.verification__ds__extract_day + , subq_0.verification__ds__extract_dayofweek + , subq_0.verification__ds__extract_dayofyear , subq_0.verification__ds_partitioned__day , subq_0.verification__ds_partitioned__week , subq_0.verification__ds_partitioned__month , subq_0.verification__ds_partitioned__quarter , subq_0.verification__ds_partitioned__year + , subq_0.verification__ds_partitioned__extract_year + , subq_0.verification__ds_partitioned__extract_quarter + , subq_0.verification__ds_partitioned__extract_month + , subq_0.verification__ds_partitioned__extract_week + , subq_0.verification__ds_partitioned__extract_day + , subq_0.verification__ds_partitioned__extract_dayofweek + , subq_0.verification__ds_partitioned__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -71,22 +99,50 @@ FROM ( , DATE_TRUNC(id_verifications_src_10003.ds, month) AS ds__month , DATE_TRUNC(id_verifications_src_10003.ds, quarter) AS ds__quarter , DATE_TRUNC(id_verifications_src_10003.ds, year) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC(id_verifications_src_10003.ds, isoweek) AS verification__ds__week , DATE_TRUNC(id_verifications_src_10003.ds, month) AS verification__ds__month , DATE_TRUNC(id_verifications_src_10003.ds, quarter) AS verification__ds__quarter , DATE_TRUNC(id_verifications_src_10003.ds, year) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS verification__ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS verification__ds_partitioned__month , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, quarter) AS verification__ds_partitioned__quarter , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, year) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user @@ -110,32 +166,74 @@ FROM ( , DATE_TRUNC(users_ds_source_src_10007.ds, month) AS ds__month , DATE_TRUNC(users_ds_source_src_10007.ds, quarter) AS ds__quarter , DATE_TRUNC(users_ds_source_src_10007.ds, year) AS ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS ds__extract_dayofyear , users_ds_source_src_10007.created_at AS created_at__day , DATE_TRUNC(users_ds_source_src_10007.created_at, isoweek) AS created_at__week , DATE_TRUNC(users_ds_source_src_10007.created_at, month) AS created_at__month , DATE_TRUNC(users_ds_source_src_10007.created_at, quarter) AS created_at__quarter , DATE_TRUNC(users_ds_source_src_10007.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state , users_ds_source_src_10007.ds AS user__ds__day , DATE_TRUNC(users_ds_source_src_10007.ds, isoweek) AS user__ds__week , DATE_TRUNC(users_ds_source_src_10007.ds, month) AS user__ds__month , DATE_TRUNC(users_ds_source_src_10007.ds, quarter) AS user__ds__quarter , DATE_TRUNC(users_ds_source_src_10007.ds, year) AS user__ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofyear , users_ds_source_src_10007.created_at AS user__created_at__day , DATE_TRUNC(users_ds_source_src_10007.created_at, isoweek) AS user__created_at__week , DATE_TRUNC(users_ds_source_src_10007.created_at, month) AS user__created_at__month , DATE_TRUNC(users_ds_source_src_10007.created_at, quarter) AS user__created_at__quarter , DATE_TRUNC(users_ds_source_src_10007.created_at, year) AS user__created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned__day , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, isoweek) AS user__ds_partitioned__week , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, month) AS user__ds_partitioned__month , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, quarter) AS user__ds_partitioned__quarter , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, year) AS user__ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state AS user__home_state , users_ds_source_src_10007.user_id AS user FROM ***************************.dim_users users_ds_source_src_10007 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql index 019d4f0431..febccc91aa 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -54,12 +82,26 @@ INNER JOIN ( , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql index d8a55e4ce8..17d01a31fc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC(ds, month) AS ds__month , DATE_TRUNC(ds, quarter) AS ds__quarter , DATE_TRUNC(ds, year) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC(ds, isoweek) AS account__ds__week , DATE_TRUNC(ds, month) AS account__ds__month , DATE_TRUNC(ds, quarter) AS account__ds__quarter , DATE_TRUNC(ds, year) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql index be0601ac7d..cc5ef6ef07 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index c01273992a..8fbb61349d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC(ds, month) AS ds__month , DATE_TRUNC(ds, quarter) AS ds__quarter , DATE_TRUNC(ds, year) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC(ds, isoweek) AS account__ds__week , DATE_TRUNC(ds, month) AS account__ds__month , DATE_TRUNC(ds, quarter) AS account__ds__quarter , DATE_TRUNC(ds, year) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 4e696ff946..ab91ef4285 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC(accounts_source_src_10000.ds, month) AS ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week , DATE_TRUNC(accounts_source_src_10000.ds, month) AS account__ds__month , DATE_TRUNC(accounts_source_src_10000.ds, quarter) AS account__ds__quarter , DATE_TRUNC(accounts_source_src_10000.ds, year) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 15961c6c39..c1a7811068 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC(ds, month) AS ds__month , DATE_TRUNC(ds, quarter) AS ds__quarter , DATE_TRUNC(ds, year) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC(ds, isoweek) AS account__ds__week , DATE_TRUNC(ds, month) AS account__ds__month , DATE_TRUNC(ds, quarter) AS account__ds__quarter , DATE_TRUNC(ds, year) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql index 5f0ad187f7..2f7370d5ba 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -83,11 +125,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -96,11 +152,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__ds__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__ds__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month , DATE_TRUNC(listings_latest_src_10004.created_at, quarter) AS listing__created_at__quarter , DATE_TRUNC(listings_latest_src_10004.created_at, year) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql index 1f8a069b02..2f0a3bb53b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql index 39876db194..d68f494296 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC(ds, month) AS ds__month , DATE_TRUNC(ds, quarter) AS ds__quarter , DATE_TRUNC(ds, year) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC(paid_at, isoweek) AS paid_at__week , DATE_TRUNC(paid_at, month) AS paid_at__month , DATE_TRUNC(paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , is_instant AS booking__is_instant , ds AS booking__ds__day , DATE_TRUNC(ds, isoweek) AS booking__ds__week , DATE_TRUNC(ds, month) AS booking__ds__month , DATE_TRUNC(ds, quarter) AS booking__ds__quarter , DATE_TRUNC(ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(paid_at, month) AS booking__paid_at__month , DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql index 214766cb17..8209ee600a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_common_semantic_model__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -239,32 +365,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql index 63637a9433..9ddc5fe579 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 9c4d91d069..e556d194aa 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -51,31 +51,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -125,32 +167,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -175,21 +259,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -218,11 +330,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -231,11 +357,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -296,21 +436,49 @@ FROM ( , subq_10.ds__month , subq_10.ds__quarter , subq_10.ds__year + , subq_10.ds__extract_year + , subq_10.ds__extract_quarter + , subq_10.ds__extract_month + , subq_10.ds__extract_week + , subq_10.ds__extract_day + , subq_10.ds__extract_dayofweek + , subq_10.ds__extract_dayofyear , subq_10.ds_partitioned__day , subq_10.ds_partitioned__week , subq_10.ds_partitioned__month , subq_10.ds_partitioned__quarter , subq_10.ds_partitioned__year + , subq_10.ds_partitioned__extract_year + , subq_10.ds_partitioned__extract_quarter + , subq_10.ds_partitioned__extract_month + , subq_10.ds_partitioned__extract_week + , subq_10.ds_partitioned__extract_day + , subq_10.ds_partitioned__extract_dayofweek + , subq_10.ds_partitioned__extract_dayofyear , subq_10.view__ds__day , subq_10.view__ds__week , subq_10.view__ds__month , subq_10.view__ds__quarter , subq_10.view__ds__year + , subq_10.view__ds__extract_year + , subq_10.view__ds__extract_quarter + , subq_10.view__ds__extract_month + , subq_10.view__ds__extract_week + , subq_10.view__ds__extract_day + , subq_10.view__ds__extract_dayofweek + , subq_10.view__ds__extract_dayofyear , subq_10.view__ds_partitioned__day , subq_10.view__ds_partitioned__week , subq_10.view__ds_partitioned__month , subq_10.view__ds_partitioned__quarter , subq_10.view__ds_partitioned__year + , subq_10.view__ds_partitioned__extract_year + , subq_10.view__ds_partitioned__extract_quarter + , subq_10.view__ds_partitioned__extract_month + , subq_10.view__ds_partitioned__extract_week + , subq_10.view__ds_partitioned__extract_day + , subq_10.view__ds_partitioned__extract_dayofweek + , subq_10.view__ds_partitioned__extract_dayofyear , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month @@ -330,21 +498,49 @@ FROM ( , DATE_TRUNC('month', views_source_src_10009.ds) AS ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM views_source_src_10009.ds) AS ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofyear , views_source_src_10009.ds AS view__ds__day , DATE_TRUNC('week', views_source_src_10009.ds) AS view__ds__week , DATE_TRUNC('month', views_source_src_10009.ds) AS view__ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS view__ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS view__ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS view__ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS view__ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS view__ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS view__ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS view__ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS view__ds__extract_dayofweek + , EXTRACT(DOY FROM views_source_src_10009.ds) AS view__ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS view__ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofyear , views_source_src_10009.listing_id AS listing , views_source_src_10009.user_id AS user , views_source_src_10009.listing_id AS view__listing @@ -367,21 +563,49 @@ FROM ( , subq_13.ds__month , subq_13.ds__quarter , subq_13.ds__year + , subq_13.ds__extract_year + , subq_13.ds__extract_quarter + , subq_13.ds__extract_month + , subq_13.ds__extract_week + , subq_13.ds__extract_day + , subq_13.ds__extract_dayofweek + , subq_13.ds__extract_dayofyear , subq_13.created_at__day , subq_13.created_at__week , subq_13.created_at__month , subq_13.created_at__quarter , subq_13.created_at__year + , subq_13.created_at__extract_year + , subq_13.created_at__extract_quarter + , subq_13.created_at__extract_month + , subq_13.created_at__extract_week + , subq_13.created_at__extract_day + , subq_13.created_at__extract_dayofweek + , subq_13.created_at__extract_dayofyear , subq_13.listing__ds__day , subq_13.listing__ds__week , subq_13.listing__ds__month , subq_13.listing__ds__quarter , subq_13.listing__ds__year + , subq_13.listing__ds__extract_year + , subq_13.listing__ds__extract_quarter + , subq_13.listing__ds__extract_month + , subq_13.listing__ds__extract_week + , subq_13.listing__ds__extract_day + , subq_13.listing__ds__extract_dayofweek + , subq_13.listing__ds__extract_dayofyear , subq_13.listing__created_at__day , subq_13.listing__created_at__week , subq_13.listing__created_at__month , subq_13.listing__created_at__quarter , subq_13.listing__created_at__year + , subq_13.listing__created_at__extract_year + , subq_13.listing__created_at__extract_quarter + , subq_13.listing__created_at__extract_month + , subq_13.listing__created_at__extract_week + , subq_13.listing__created_at__extract_day + , subq_13.listing__created_at__extract_dayofweek + , subq_13.listing__created_at__extract_dayofyear , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month @@ -410,11 +634,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -423,11 +661,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index dd55a54b61..f47fd76de7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -47,32 +47,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -99,11 +141,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -112,11 +168,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql index 48583b238a..3eb622fa49 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql index 4ca35f2544..2b0077fe9a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql @@ -38,32 +38,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql index b515ad2da5..7a21860fcb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql index 5eb893b84a..98ba846b40 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql index 2393630095..4695227af1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql @@ -18,11 +18,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -40,11 +54,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql index 9ced88e0cc..d7d79e0e55 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index dd00d2b15e..ea1c3531d4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql index 658dcf3357..553a0f19f7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DOY FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql index 9bafb5e1f6..50f09e5c00 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -170,31 +254,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -244,32 +370,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql index edbbe545fd..82c9f10475 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index c97b8fd930..9fe9c136c1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql index 03b1c29282..daa52ca41e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 6a32edb464..aa0f8a119a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index d52164ec94..ecc7b21c32 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -235,31 +361,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,31 +463,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -369,32 +579,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 1a2a3259ba..9ab034b843 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -236,31 +362,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,31 +464,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -370,32 +580,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql index edd3eef59c..a3509be579 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_4.ds__month AS ds__month , subq_4.ds__quarter AS ds__quarter , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_week AS ds__extract_week + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_4.ds__extract_dayofyear AS ds__extract_dayofyear , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , subq_4.ds_partitioned__year AS ds_partitioned__year + , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_4.paid_at__day AS paid_at__day , subq_4.paid_at__week AS paid_at__week , subq_4.paid_at__month AS paid_at__month , subq_4.paid_at__quarter AS paid_at__quarter , subq_4.paid_at__year AS paid_at__year + , subq_4.paid_at__extract_year AS paid_at__extract_year + , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_4.paid_at__extract_month AS paid_at__extract_month + , subq_4.paid_at__extract_week AS paid_at__extract_week + , subq_4.paid_at__extract_day AS paid_at__extract_day + , subq_4.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_4.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_4.booking__ds__day AS booking__ds__day , subq_4.booking__ds__week AS booking__ds__week , subq_4.booking__ds__month AS booking__ds__month , subq_4.booking__ds__quarter AS booking__ds__quarter , subq_4.booking__ds__year AS booking__ds__year + , subq_4.booking__ds__extract_year AS booking__ds__extract_year + , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_4.booking__ds__extract_month AS booking__ds__extract_month + , subq_4.booking__ds__extract_week AS booking__ds__extract_week + , subq_4.booking__ds__extract_day AS booking__ds__extract_day + , subq_4.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_4.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_4.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_4.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_4.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_4.booking__paid_at__day AS booking__paid_at__day , subq_4.booking__paid_at__week AS booking__paid_at__week , subq_4.booking__paid_at__month AS booking__paid_at__month , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter , subq_4.booking__paid_at__year AS booking__paid_at__year + , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_4.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_4.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_4.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,31 +130,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , 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 @@ -152,31 +236,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -226,32 +352,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql index 26c360ab9e..466af8e156 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,31 +129,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -161,32 +245,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql index 870b2c80ea..049dfd23fb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_distinct_values__plan0.sql @@ -42,31 +42,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -116,32 +158,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -166,21 +250,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -209,11 +321,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -222,11 +348,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql index ddba65921c..ceb7438a40 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql @@ -25,32 +25,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql index 7ce1a71c7f..95f3b7ed5a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql index 81e6d39ada..479ed8d1ef 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -48,31 +48,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -122,32 +164,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -172,21 +256,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -215,11 +327,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -228,11 +354,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql index 4caa3d07f0..b0217f0775 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0.sql @@ -30,8 +30,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_4.window_start__day AS listing__window_start__day - , subq_4.window_end__day AS listing__window_end__day + , subq_4.window_start__extract_day AS listing__window_start__extract_day + , subq_4.window_end__extract_year AS listing__window_end__extract_year , subq_2.listing AS listing , subq_4.capacity AS listing__capacity , subq_2.bookings AS bookings @@ -50,31 +50,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -110,32 +152,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -152,8 +236,8 @@ FROM ( -- Pass Only Elements: -- ['capacity', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_3.window_start__day - , subq_3.window_end__day + subq_3.window_start__extract_day + , subq_3.window_end__extract_year , subq_3.listing , subq_3.capacity FROM ( @@ -164,11 +248,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +275,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -196,12 +308,12 @@ FROM ( subq_2.listing = subq_4.listing ) AND ( ( - subq_2.metric_time__day >= subq_4.window_start__day + subq_2.metric_time__day >= subq_4.window_start__extract_day ) AND ( ( - subq_2.metric_time__day < subq_4.window_end__day + subq_2.metric_time__day < subq_4.window_end__extract_year ) OR ( - subq_4.window_end__day IS NULL + subq_4.window_end__extract_year IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql index 86a2010b35..33b2abdc23 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_scd_dimension__plan0_optimized.sql @@ -32,12 +32,12 @@ FROM ( subq_12.listing = listings_src_10017.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10017.active_from + subq_12.metric_time__day >= EXTRACT(DAY FROM listings_src_10017.active_from) ) AND ( ( - subq_12.metric_time__day < listings_src_10017.active_to + subq_12.metric_time__day < EXTRACT(YEAR FROM listings_src_10017.active_to) ) OR ( - listings_src_10017.active_to IS NULL + EXTRACT(YEAR FROM listings_src_10017.active_to) IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 6ed1bd4e99..70accec611 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql index 22702f0c48..a6aabb20c2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql index 027f20ea5b..80e8fdda4b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql index 913fed793c..42f33bb96e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_limit_rows__plan0.sql @@ -26,31 +26,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql index 86b30c4553..973abdbb6f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_local_dimension_using_local_entity__plan0.sql @@ -21,21 +21,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.created_at__day , subq_0.created_at__week , subq_0.created_at__month , subq_0.created_at__quarter , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_week + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dayofweek + , subq_0.created_at__extract_dayofyear , subq_0.listing__ds__day , subq_0.listing__ds__week , subq_0.listing__ds__month , subq_0.listing__ds__quarter , subq_0.listing__ds__year + , subq_0.listing__ds__extract_year + , subq_0.listing__ds__extract_quarter + , subq_0.listing__ds__extract_month + , subq_0.listing__ds__extract_week + , subq_0.listing__ds__extract_day + , subq_0.listing__ds__extract_dayofweek + , subq_0.listing__ds__extract_dayofyear , subq_0.listing__created_at__day , subq_0.listing__created_at__week , subq_0.listing__created_at__month , subq_0.listing__created_at__quarter , subq_0.listing__created_at__year + , subq_0.listing__created_at__extract_year + , subq_0.listing__created_at__extract_quarter + , subq_0.listing__created_at__extract_month + , subq_0.listing__created_at__extract_week + , subq_0.listing__created_at__extract_day + , subq_0.listing__created_at__extract_dayofweek + , subq_0.listing__created_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -77,11 +119,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql index 316737d00a..97140fd5a8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql @@ -35,32 +35,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql index 73e6a70d92..c99d63cffa 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint__plan0.sql @@ -60,31 +60,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -134,32 +176,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -184,21 +268,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -227,11 +339,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -240,11 +366,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -317,31 +457,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -391,32 +573,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -441,21 +665,49 @@ FROM ( , subq_15.ds__month , subq_15.ds__quarter , subq_15.ds__year + , subq_15.ds__extract_year + , subq_15.ds__extract_quarter + , subq_15.ds__extract_month + , subq_15.ds__extract_week + , subq_15.ds__extract_day + , subq_15.ds__extract_dayofweek + , subq_15.ds__extract_dayofyear , subq_15.created_at__day , subq_15.created_at__week , subq_15.created_at__month , subq_15.created_at__quarter , subq_15.created_at__year + , subq_15.created_at__extract_year + , subq_15.created_at__extract_quarter + , subq_15.created_at__extract_month + , subq_15.created_at__extract_week + , subq_15.created_at__extract_day + , subq_15.created_at__extract_dayofweek + , subq_15.created_at__extract_dayofyear , subq_15.listing__ds__day , subq_15.listing__ds__week , subq_15.listing__ds__month , subq_15.listing__ds__quarter , subq_15.listing__ds__year + , subq_15.listing__ds__extract_year + , subq_15.listing__ds__extract_quarter + , subq_15.listing__ds__extract_month + , subq_15.listing__ds__extract_week + , subq_15.listing__ds__extract_day + , subq_15.listing__ds__extract_dayofweek + , subq_15.listing__ds__extract_dayofyear , subq_15.listing__created_at__day , subq_15.listing__created_at__week , subq_15.listing__created_at__month , subq_15.listing__created_at__quarter , subq_15.listing__created_at__year + , subq_15.listing__created_at__extract_year + , subq_15.listing__created_at__extract_quarter + , subq_15.listing__created_at__extract_month + , subq_15.listing__created_at__extract_week + , subq_15.listing__created_at__extract_day + , subq_15.listing__created_at__extract_dayofweek + , subq_15.listing__created_at__extract_dayofyear , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month @@ -484,11 +736,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -497,11 +763,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -557,31 +837,73 @@ FROM ( , subq_24.ds__month , subq_24.ds__quarter , subq_24.ds__year + , subq_24.ds__extract_year + , subq_24.ds__extract_quarter + , subq_24.ds__extract_month + , subq_24.ds__extract_week + , subq_24.ds__extract_day + , subq_24.ds__extract_dayofweek + , subq_24.ds__extract_dayofyear , subq_24.ds_partitioned__day , subq_24.ds_partitioned__week , subq_24.ds_partitioned__month , subq_24.ds_partitioned__quarter , subq_24.ds_partitioned__year + , subq_24.ds_partitioned__extract_year + , subq_24.ds_partitioned__extract_quarter + , subq_24.ds_partitioned__extract_month + , subq_24.ds_partitioned__extract_week + , subq_24.ds_partitioned__extract_day + , subq_24.ds_partitioned__extract_dayofweek + , subq_24.ds_partitioned__extract_dayofyear , subq_24.paid_at__day , subq_24.paid_at__week , subq_24.paid_at__month , subq_24.paid_at__quarter , subq_24.paid_at__year + , subq_24.paid_at__extract_year + , subq_24.paid_at__extract_quarter + , subq_24.paid_at__extract_month + , subq_24.paid_at__extract_week + , subq_24.paid_at__extract_day + , subq_24.paid_at__extract_dayofweek + , subq_24.paid_at__extract_dayofyear , subq_24.booking__ds__day , subq_24.booking__ds__week , subq_24.booking__ds__month , subq_24.booking__ds__quarter , subq_24.booking__ds__year + , subq_24.booking__ds__extract_year + , subq_24.booking__ds__extract_quarter + , subq_24.booking__ds__extract_month + , subq_24.booking__ds__extract_week + , subq_24.booking__ds__extract_day + , subq_24.booking__ds__extract_dayofweek + , subq_24.booking__ds__extract_dayofyear , subq_24.booking__ds_partitioned__day , subq_24.booking__ds_partitioned__week , subq_24.booking__ds_partitioned__month , subq_24.booking__ds_partitioned__quarter , subq_24.booking__ds_partitioned__year + , subq_24.booking__ds_partitioned__extract_year + , subq_24.booking__ds_partitioned__extract_quarter + , subq_24.booking__ds_partitioned__extract_month + , subq_24.booking__ds_partitioned__extract_week + , subq_24.booking__ds_partitioned__extract_day + , subq_24.booking__ds_partitioned__extract_dayofweek + , subq_24.booking__ds_partitioned__extract_dayofyear , subq_24.booking__paid_at__day , subq_24.booking__paid_at__week , subq_24.booking__paid_at__month , subq_24.booking__paid_at__quarter , subq_24.booking__paid_at__year + , subq_24.booking__paid_at__extract_year + , subq_24.booking__paid_at__extract_quarter + , subq_24.booking__paid_at__extract_month + , subq_24.booking__paid_at__extract_week + , subq_24.booking__paid_at__extract_day + , subq_24.booking__paid_at__extract_dayofweek + , subq_24.booking__paid_at__extract_dayofyear , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month @@ -631,32 +953,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql index 4176ca90e9..1e3f035827 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0.sql @@ -45,31 +45,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -119,32 +161,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -186,31 +270,73 @@ FROM ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.ds_partitioned__day , subq_7.ds_partitioned__week , subq_7.ds_partitioned__month , subq_7.ds_partitioned__quarter , subq_7.ds_partitioned__year + , subq_7.ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_week + , subq_7.ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dayofweek + , subq_7.ds_partitioned__extract_dayofyear , subq_7.paid_at__day , subq_7.paid_at__week , subq_7.paid_at__month , subq_7.paid_at__quarter , subq_7.paid_at__year + , subq_7.paid_at__extract_year + , subq_7.paid_at__extract_quarter + , subq_7.paid_at__extract_month + , subq_7.paid_at__extract_week + , subq_7.paid_at__extract_day + , subq_7.paid_at__extract_dayofweek + , subq_7.paid_at__extract_dayofyear , subq_7.booking__ds__day , subq_7.booking__ds__week , subq_7.booking__ds__month , subq_7.booking__ds__quarter , subq_7.booking__ds__year + , subq_7.booking__ds__extract_year + , subq_7.booking__ds__extract_quarter + , subq_7.booking__ds__extract_month + , subq_7.booking__ds__extract_week + , subq_7.booking__ds__extract_day + , subq_7.booking__ds__extract_dayofweek + , subq_7.booking__ds__extract_dayofyear , subq_7.booking__ds_partitioned__day , subq_7.booking__ds_partitioned__week , subq_7.booking__ds_partitioned__month , subq_7.booking__ds_partitioned__quarter , subq_7.booking__ds_partitioned__year + , subq_7.booking__ds_partitioned__extract_year + , subq_7.booking__ds_partitioned__extract_quarter + , subq_7.booking__ds_partitioned__extract_month + , subq_7.booking__ds_partitioned__extract_week + , subq_7.booking__ds_partitioned__extract_day + , subq_7.booking__ds_partitioned__extract_dayofweek + , subq_7.booking__ds_partitioned__extract_dayofyear , subq_7.booking__paid_at__day , subq_7.booking__paid_at__week , subq_7.booking__paid_at__month , subq_7.booking__paid_at__quarter , subq_7.booking__paid_at__year + , subq_7.booking__paid_at__extract_year + , subq_7.booking__paid_at__extract_quarter + , subq_7.booking__paid_at__extract_month + , subq_7.booking__paid_at__extract_week + , subq_7.booking__paid_at__extract_day + , subq_7.booking__paid_at__extract_dayofweek + , subq_7.booking__paid_at__extract_dayofyear , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month @@ -260,32 +386,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 13d80a91d0..1286214deb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -39,31 +39,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -113,32 +155,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 14ec230f17..0b3cc84657 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -160,21 +244,49 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.created_at__day , subq_5.created_at__week , subq_5.created_at__month , subq_5.created_at__quarter , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_week + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dayofweek + , subq_5.created_at__extract_dayofyear , subq_5.listing__ds__day , subq_5.listing__ds__week , subq_5.listing__ds__month , subq_5.listing__ds__quarter , subq_5.listing__ds__year + , subq_5.listing__ds__extract_year + , subq_5.listing__ds__extract_quarter + , subq_5.listing__ds__extract_month + , subq_5.listing__ds__extract_week + , subq_5.listing__ds__extract_day + , subq_5.listing__ds__extract_dayofweek + , subq_5.listing__ds__extract_dayofyear , subq_5.listing__created_at__day , subq_5.listing__created_at__week , subq_5.listing__created_at__month , subq_5.listing__created_at__quarter , subq_5.listing__created_at__year + , subq_5.listing__created_at__extract_year + , subq_5.listing__created_at__extract_quarter + , subq_5.listing__created_at__extract_month + , subq_5.listing__created_at__extract_week + , subq_5.listing__created_at__extract_day + , subq_5.listing__created_at__extract_dayofweek + , subq_5.listing__created_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -203,11 +315,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -216,11 +342,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql index 88cc0b431d..6dfa7be757 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.window_start__day AS listing__window_start__day - , subq_7.window_end__day AS listing__window_end__day + , subq_7.window_start__extract_day AS listing__window_start__extract_day + , subq_7.window_end__extract_year AS listing__window_end__extract_year , subq_2.listing AS listing , subq_7.user__home_state_latest AS listing__user__home_state_latest , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -142,8 +226,8 @@ FROM ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_6.window_start__day - , subq_6.window_end__day + subq_6.window_start__extract_day + , subq_6.window_end__extract_year , subq_6.listing , subq_6.user__home_state_latest FROM ( @@ -154,26 +238,61 @@ FROM ( , subq_3.window_start__month AS window_start__month , subq_3.window_start__quarter AS window_start__quarter , subq_3.window_start__year AS window_start__year + , subq_3.window_start__extract_year AS window_start__extract_year + , subq_3.window_start__extract_quarter AS window_start__extract_quarter + , subq_3.window_start__extract_month AS window_start__extract_month + , subq_3.window_start__extract_week AS window_start__extract_week + , subq_3.window_start__extract_day AS window_start__extract_day + , subq_3.window_start__extract_dayofweek AS window_start__extract_dayofweek + , subq_3.window_start__extract_dayofyear AS window_start__extract_dayofyear , subq_3.window_end__day AS window_end__day , subq_3.window_end__week AS window_end__week , subq_3.window_end__month AS window_end__month , subq_3.window_end__quarter AS window_end__quarter , subq_3.window_end__year AS window_end__year + , subq_3.window_end__extract_year AS window_end__extract_year + , subq_3.window_end__extract_quarter AS window_end__extract_quarter + , subq_3.window_end__extract_month AS window_end__extract_month + , subq_3.window_end__extract_week AS window_end__extract_week + , subq_3.window_end__extract_day AS window_end__extract_day + , subq_3.window_end__extract_dayofweek AS window_end__extract_dayofweek + , subq_3.window_end__extract_dayofyear AS window_end__extract_dayofyear , subq_3.listing__window_start__day AS listing__window_start__day , subq_3.listing__window_start__week AS listing__window_start__week , subq_3.listing__window_start__month AS listing__window_start__month , subq_3.listing__window_start__quarter AS listing__window_start__quarter , subq_3.listing__window_start__year AS listing__window_start__year + , subq_3.listing__window_start__extract_year AS listing__window_start__extract_year + , subq_3.listing__window_start__extract_quarter AS listing__window_start__extract_quarter + , subq_3.listing__window_start__extract_month AS listing__window_start__extract_month + , subq_3.listing__window_start__extract_week AS listing__window_start__extract_week + , subq_3.listing__window_start__extract_day AS listing__window_start__extract_day + , subq_3.listing__window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_3.listing__window_start__extract_dayofyear AS listing__window_start__extract_dayofyear , subq_3.listing__window_end__day AS listing__window_end__day , subq_3.listing__window_end__week AS listing__window_end__week , subq_3.listing__window_end__month AS listing__window_end__month , subq_3.listing__window_end__quarter AS listing__window_end__quarter , subq_3.listing__window_end__year AS listing__window_end__year + , subq_3.listing__window_end__extract_year AS listing__window_end__extract_year + , subq_3.listing__window_end__extract_quarter AS listing__window_end__extract_quarter + , subq_3.listing__window_end__extract_month AS listing__window_end__extract_month + , subq_3.listing__window_end__extract_week AS listing__window_end__extract_week + , subq_3.listing__window_end__extract_day AS listing__window_end__extract_day + , subq_3.listing__window_end__extract_dayofweek AS listing__window_end__extract_dayofweek + , subq_3.listing__window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dayofweek AS user__ds__extract_dayofweek + , subq_5.ds__extract_dayofyear AS user__ds__extract_dayofyear , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +311,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +338,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DOY FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -227,11 +374,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +400,25 @@ FROM ( , subq_4.ds__month , subq_4.ds__quarter , subq_4.ds__year + , subq_4.ds__extract_year + , subq_4.ds__extract_quarter + , subq_4.ds__extract_month + , subq_4.ds__extract_week + , subq_4.ds__extract_day + , subq_4.ds__extract_dayofweek + , subq_4.ds__extract_dayofyear , subq_4.user__ds__day , subq_4.user__ds__week , subq_4.user__ds__month , subq_4.user__ds__quarter , subq_4.user__ds__year + , subq_4.user__ds__extract_year + , subq_4.user__ds__extract_quarter + , subq_4.user__ds__extract_month + , subq_4.user__ds__extract_week + , subq_4.user__ds__extract_day + , subq_4.user__ds__extract_dayofweek + , subq_4.user__ds__extract_dayofyear , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +430,26 @@ FROM ( , DATE_TRUNC('month', users_latest_src_10021.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM users_latest_src_10021.ds) AS ds__extract_dayofyear , users_latest_src_10021.home_state_latest , users_latest_src_10021.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10021.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10021.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_dayofweek + , EXTRACT(DOY FROM users_latest_src_10021.ds) AS user__ds__extract_dayofyear , users_latest_src_10021.home_state_latest AS user__home_state_latest , users_latest_src_10021.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10021 @@ -275,12 +464,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.window_start__day + subq_2.metric_time__day >= subq_7.window_start__extract_day ) AND ( ( - subq_2.metric_time__day < subq_7.window_end__day + subq_2.metric_time__day < subq_7.window_end__extract_year ) OR ( - subq_7.window_end__day IS NULL + subq_7.window_end__extract_year IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql index feb5ed0fdc..763192fed5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -23,8 +23,8 @@ LEFT OUTER JOIN ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10017.active_from AS window_start__day - , listings_src_10017.active_to AS window_end__day + EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year , listings_src_10017.listing_id AS listing , users_latest_src_10021.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings listings_src_10017 @@ -38,12 +38,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.window_start__day + subq_13.metric_time__day >= subq_18.window_start__extract_day ) AND ( ( - subq_13.metric_time__day < subq_18.window_end__day + subq_13.metric_time__day < subq_18.window_end__extract_year ) OR ( - subq_18.window_end__day IS NULL + subq_18.window_end__extract_year IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql index 94054a124c..ae72bbcdef 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.lux_listing__window_start__day AS listing__lux_listing__window_start__day - , subq_7.lux_listing__window_end__day AS listing__lux_listing__window_end__day + , subq_7.lux_listing__window_start__extract_year AS listing__lux_listing__window_start__extract_year + , subq_7.lux_listing__window_end__extract_quarter AS listing__lux_listing__window_end__extract_quarter , subq_2.listing AS listing , subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -145,8 +229,8 @@ FROM ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - subq_6.lux_listing__window_start__day - , subq_6.lux_listing__window_end__day + subq_6.lux_listing__window_start__extract_year + , subq_6.lux_listing__window_end__extract_quarter , subq_6.listing , subq_6.lux_listing__is_confirmed_lux FROM ( @@ -157,11 +241,25 @@ FROM ( , subq_5.window_start__month AS lux_listing__window_start__month , subq_5.window_start__quarter AS lux_listing__window_start__quarter , subq_5.window_start__year AS lux_listing__window_start__year + , subq_5.window_start__extract_year AS lux_listing__window_start__extract_year + , subq_5.window_start__extract_quarter AS lux_listing__window_start__extract_quarter + , subq_5.window_start__extract_month AS lux_listing__window_start__extract_month + , subq_5.window_start__extract_week AS lux_listing__window_start__extract_week + , subq_5.window_start__extract_day AS lux_listing__window_start__extract_day + , subq_5.window_start__extract_dayofweek AS lux_listing__window_start__extract_dayofweek + , subq_5.window_start__extract_dayofyear AS lux_listing__window_start__extract_dayofyear , subq_5.window_end__day AS lux_listing__window_end__day , subq_5.window_end__week AS lux_listing__window_end__week , subq_5.window_end__month AS lux_listing__window_end__month , subq_5.window_end__quarter AS lux_listing__window_end__quarter , subq_5.window_end__year AS lux_listing__window_end__year + , subq_5.window_end__extract_year AS lux_listing__window_end__extract_year + , subq_5.window_end__extract_quarter AS lux_listing__window_end__extract_quarter + , subq_5.window_end__extract_month AS lux_listing__window_end__extract_month + , subq_5.window_end__extract_week AS lux_listing__window_end__extract_week + , subq_5.window_end__extract_day AS lux_listing__window_end__extract_day + , subq_5.window_end__extract_dayofweek AS lux_listing__window_end__extract_dayofweek + , subq_5.window_end__extract_dayofyear AS lux_listing__window_end__extract_dayofyear , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +281,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +331,49 @@ FROM ( , subq_4.window_start__month , subq_4.window_start__quarter , subq_4.window_start__year + , subq_4.window_start__extract_year + , subq_4.window_start__extract_quarter + , subq_4.window_start__extract_month + , subq_4.window_start__extract_week + , subq_4.window_start__extract_day + , subq_4.window_start__extract_dayofweek + , subq_4.window_start__extract_dayofyear , subq_4.window_end__day , subq_4.window_end__week , subq_4.window_end__month , subq_4.window_end__quarter , subq_4.window_end__year + , subq_4.window_end__extract_year + , subq_4.window_end__extract_quarter + , subq_4.window_end__extract_month + , subq_4.window_end__extract_week + , subq_4.window_end__extract_day + , subq_4.window_end__extract_dayofweek + , subq_4.window_end__extract_dayofyear , subq_4.lux_listing__window_start__day , subq_4.lux_listing__window_start__week , subq_4.lux_listing__window_start__month , subq_4.lux_listing__window_start__quarter , subq_4.lux_listing__window_start__year + , subq_4.lux_listing__window_start__extract_year + , subq_4.lux_listing__window_start__extract_quarter + , subq_4.lux_listing__window_start__extract_month + , subq_4.lux_listing__window_start__extract_week + , subq_4.lux_listing__window_start__extract_day + , subq_4.lux_listing__window_start__extract_dayofweek + , subq_4.lux_listing__window_start__extract_dayofyear , subq_4.lux_listing__window_end__day , subq_4.lux_listing__window_end__week , subq_4.lux_listing__window_end__month , subq_4.lux_listing__window_end__quarter , subq_4.lux_listing__window_end__year + , subq_4.lux_listing__window_end__extract_year + , subq_4.lux_listing__window_end__extract_quarter + , subq_4.lux_listing__window_end__extract_month + , subq_4.lux_listing__window_end__extract_week + , subq_4.lux_listing__window_end__extract_day + , subq_4.lux_listing__window_end__extract_dayofweek + , subq_4.lux_listing__window_end__extract_dayofyear , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +385,50 @@ FROM ( , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofweek + , EXTRACT(DOY FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofweek + , EXTRACT(DOY FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux , lux_listings_src_10019.valid_from AS lux_listing__window_start__day , DATE_TRUNC('week', lux_listings_src_10019.valid_from) AS lux_listing__window_start__week , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS lux_listing__window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS lux_listing__window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS lux_listing__window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofweek + , EXTRACT(DOY FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS lux_listing__window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS lux_listing__window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS lux_listing__window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS lux_listing__window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS lux_listing__window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofweek + , EXTRACT(DOY FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux , lux_listings_src_10019.lux_listing_id AS lux_listing FROM ***************************.dim_lux_listings lux_listings_src_10019 @@ -261,12 +443,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.lux_listing__window_start__day + subq_2.metric_time__day >= subq_7.lux_listing__window_start__extract_year ) AND ( ( - subq_2.metric_time__day < subq_7.lux_listing__window_end__day + subq_2.metric_time__day < subq_7.lux_listing__window_end__extract_quarter ) OR ( - subq_7.lux_listing__window_end__day IS NULL + subq_7.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql index f1b419a284..0d00fd3b9a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -26,8 +26,8 @@ LEFT OUTER JOIN ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - lux_listings_src_10019.valid_from AS lux_listing__window_start__day - , lux_listings_src_10019.valid_to AS lux_listing__window_end__day + EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter , lux_listing_mapping_src_10018.listing_id AS listing , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10018 @@ -41,12 +41,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.lux_listing__window_start__day + subq_13.metric_time__day >= subq_18.lux_listing__window_start__extract_year ) AND ( ( - subq_13.metric_time__day < subq_18.lux_listing__window_end__day + subq_13.metric_time__day < subq_18.lux_listing__window_end__extract_quarter ) OR ( - subq_18.lux_listing__window_end__day IS NULL + subq_18.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql index ae8b7838b7..027d1adb23 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql @@ -33,32 +33,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -85,11 +127,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -98,11 +154,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -131,11 +201,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -144,11 +228,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql index d35179ebf0..234bd823d2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.ds__day , subq_0.ds__week , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.account_id__ds_partitioned__day , subq_0.account_id__ds_partitioned__week , subq_0.account_id__ds_partitioned__month , subq_0.account_id__ds_partitioned__quarter , subq_0.account_id__ds_partitioned__year + , subq_0.account_id__ds_partitioned__extract_year + , subq_0.account_id__ds_partitioned__extract_quarter + , subq_0.account_id__ds_partitioned__extract_month + , subq_0.account_id__ds_partitioned__extract_week + , subq_0.account_id__ds_partitioned__extract_day + , subq_0.account_id__ds_partitioned__extract_dayofweek + , subq_0.account_id__ds_partitioned__extract_dayofyear , subq_0.account_id__ds__day , subq_0.account_id__ds__week , subq_0.account_id__ds__month , subq_0.account_id__ds__quarter , subq_0.account_id__ds__year + , subq_0.account_id__ds__extract_year + , subq_0.account_id__ds__extract_quarter + , subq_0.account_id__ds__extract_month + , subq_0.account_id__ds__extract_week + , subq_0.account_id__ds__extract_day + , subq_0.account_id__ds__extract_dayofweek + , subq_0.account_id__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -69,22 +97,50 @@ FROM ( , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM account_month_txns_src_10010.ds) AS ds__extract_dayofyear , account_month_txns_src_10010.account_month , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS account_id__ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS account_id__ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS account_id__ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS account_id__ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS account_id__ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofweek + , EXTRACT(DOY FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofyear , account_month_txns_src_10010.account_month AS account_id__account_month , account_month_txns_src_10010.account_id FROM ***************************.account_month_txns account_month_txns_src_10010 @@ -106,16 +162,37 @@ FROM ( , subq_3.ds_partitioned__month AS ds_partitioned__month , subq_3.ds_partitioned__quarter AS ds_partitioned__quarter , subq_3.ds_partitioned__year AS ds_partitioned__year + , subq_3.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_3.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_3.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_3.account_id__ds_partitioned__day AS account_id__ds_partitioned__day , subq_3.account_id__ds_partitioned__week AS account_id__ds_partitioned__week , subq_3.account_id__ds_partitioned__month AS account_id__ds_partitioned__month , subq_3.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter , subq_3.account_id__ds_partitioned__year AS account_id__ds_partitioned__year + , subq_3.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year + , subq_3.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter + , subq_3.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month + , subq_3.account_id__ds_partitioned__extract_week AS account_id__ds_partitioned__extract_week + , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day + , subq_3.account_id__ds_partitioned__extract_dayofweek AS account_id__ds_partitioned__extract_dayofweek + , subq_3.account_id__ds_partitioned__extract_dayofyear AS account_id__ds_partitioned__extract_dayofyear , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month , subq_5.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter , subq_5.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_5.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week AS customer_id__ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek AS customer_id__ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear AS customer_id__ds_partitioned__extract_dayofyear , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id @@ -132,12 +209,26 @@ FROM ( , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofyear , bridge_table_src_10011.extra_dim AS account_id__extra_dim , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id @@ -154,11 +245,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +271,25 @@ FROM ( , subq_4.ds_partitioned__month , subq_4.ds_partitioned__quarter , subq_4.ds_partitioned__year + , subq_4.ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear , subq_4.customer_id__ds_partitioned__day , subq_4.customer_id__ds_partitioned__week , subq_4.customer_id__ds_partitioned__month , subq_4.customer_id__ds_partitioned__quarter , subq_4.customer_id__ds_partitioned__year + , subq_4.customer_id__ds_partitioned__extract_year + , subq_4.customer_id__ds_partitioned__extract_quarter + , subq_4.customer_id__ds_partitioned__extract_month + , subq_4.customer_id__ds_partitioned__extract_week + , subq_4.customer_id__ds_partitioned__extract_day + , subq_4.customer_id__ds_partitioned__extract_dayofweek + , subq_4.customer_id__ds_partitioned__extract_dayofyear , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +305,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_name AS customer_id__customer_name , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned__day @@ -193,6 +319,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_id FROM ***************************.customer_table customer_table_src_10013 ) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql index 5c9089deaf..1ee70afb0b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multiple_metrics_no_dimensions__plan0.sql @@ -23,31 +23,73 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.ds_partitioned__day , subq_1.ds_partitioned__week , subq_1.ds_partitioned__month , subq_1.ds_partitioned__quarter , subq_1.ds_partitioned__year + , subq_1.ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear , subq_1.paid_at__day , subq_1.paid_at__week , subq_1.paid_at__month , subq_1.paid_at__quarter , subq_1.paid_at__year + , subq_1.paid_at__extract_year + , subq_1.paid_at__extract_quarter + , subq_1.paid_at__extract_month + , subq_1.paid_at__extract_week + , subq_1.paid_at__extract_day + , subq_1.paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear , subq_1.booking__ds__day , subq_1.booking__ds__week , subq_1.booking__ds__month , subq_1.booking__ds__quarter , subq_1.booking__ds__year + , subq_1.booking__ds__extract_year + , subq_1.booking__ds__extract_quarter + , subq_1.booking__ds__extract_month + , subq_1.booking__ds__extract_week + , subq_1.booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear , subq_1.booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month , subq_1.booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day , subq_1.booking__paid_at__week , subq_1.booking__paid_at__month , subq_1.booking__paid_at__quarter , subq_1.booking__paid_at__year + , subq_1.booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -82,31 +124,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -156,32 +240,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -217,21 +343,49 @@ CROSS JOIN ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.created_at__day , subq_7.created_at__week , subq_7.created_at__month , subq_7.created_at__quarter , subq_7.created_at__year + , subq_7.created_at__extract_year + , subq_7.created_at__extract_quarter + , subq_7.created_at__extract_month + , subq_7.created_at__extract_week + , subq_7.created_at__extract_day + , subq_7.created_at__extract_dayofweek + , subq_7.created_at__extract_dayofyear , subq_7.listing__ds__day , subq_7.listing__ds__week , subq_7.listing__ds__month , subq_7.listing__ds__quarter , subq_7.listing__ds__year + , subq_7.listing__ds__extract_year + , subq_7.listing__ds__extract_quarter + , subq_7.listing__ds__extract_month + , subq_7.listing__ds__extract_week + , subq_7.listing__ds__extract_day + , subq_7.listing__ds__extract_dayofweek + , subq_7.listing__ds__extract_dayofyear , subq_7.listing__created_at__day , subq_7.listing__created_at__week , subq_7.listing__created_at__month , subq_7.listing__created_at__quarter , subq_7.listing__created_at__year + , subq_7.listing__created_at__extract_year + , subq_7.listing__created_at__extract_quarter + , subq_7.listing__created_at__extract_month + , subq_7.listing__created_at__extract_week + , subq_7.listing__created_at__extract_day + , subq_7.listing__created_at__extract_dayofweek + , subq_7.listing__created_at__extract_dayofyear , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month @@ -257,21 +411,49 @@ CROSS JOIN ( , subq_6.ds__month , subq_6.ds__quarter , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_week + , subq_6.ds__extract_day + , subq_6.ds__extract_dayofweek + , subq_6.ds__extract_dayofyear , subq_6.created_at__day , subq_6.created_at__week , subq_6.created_at__month , subq_6.created_at__quarter , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_week + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dayofweek + , subq_6.created_at__extract_dayofyear , subq_6.listing__ds__day , subq_6.listing__ds__week , subq_6.listing__ds__month , subq_6.listing__ds__quarter , subq_6.listing__ds__year + , subq_6.listing__ds__extract_year + , subq_6.listing__ds__extract_quarter + , subq_6.listing__ds__extract_month + , subq_6.listing__ds__extract_week + , subq_6.listing__ds__extract_day + , subq_6.listing__ds__extract_dayofweek + , subq_6.listing__ds__extract_dayofyear , subq_6.listing__created_at__day , subq_6.listing__created_at__week , subq_6.listing__created_at__month , subq_6.listing__created_at__quarter , subq_6.listing__created_at__year + , subq_6.listing__created_at__extract_year + , subq_6.listing__created_at__extract_quarter + , subq_6.listing__created_at__extract_month + , subq_6.listing__created_at__extract_week + , subq_6.listing__created_at__extract_day + , subq_6.listing__created_at__extract_dayofweek + , subq_6.listing__created_at__extract_dayofyear , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month @@ -300,11 +482,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -313,11 +509,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql index 14a9f0385a..7cc6e2d906 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql @@ -44,31 +44,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -118,32 +160,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -182,31 +266,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -256,32 +382,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -332,31 +500,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -406,32 +616,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -480,31 +732,73 @@ FROM ( , subq_17.ds__month , subq_17.ds__quarter , subq_17.ds__year + , subq_17.ds__extract_year + , subq_17.ds__extract_quarter + , subq_17.ds__extract_month + , subq_17.ds__extract_week + , subq_17.ds__extract_day + , subq_17.ds__extract_dayofweek + , subq_17.ds__extract_dayofyear , subq_17.ds_partitioned__day , subq_17.ds_partitioned__week , subq_17.ds_partitioned__month , subq_17.ds_partitioned__quarter , subq_17.ds_partitioned__year + , subq_17.ds_partitioned__extract_year + , subq_17.ds_partitioned__extract_quarter + , subq_17.ds_partitioned__extract_month + , subq_17.ds_partitioned__extract_week + , subq_17.ds_partitioned__extract_day + , subq_17.ds_partitioned__extract_dayofweek + , subq_17.ds_partitioned__extract_dayofyear , subq_17.paid_at__day , subq_17.paid_at__week , subq_17.paid_at__month , subq_17.paid_at__quarter , subq_17.paid_at__year + , subq_17.paid_at__extract_year + , subq_17.paid_at__extract_quarter + , subq_17.paid_at__extract_month + , subq_17.paid_at__extract_week + , subq_17.paid_at__extract_day + , subq_17.paid_at__extract_dayofweek + , subq_17.paid_at__extract_dayofyear , subq_17.booking__ds__day , subq_17.booking__ds__week , subq_17.booking__ds__month , subq_17.booking__ds__quarter , subq_17.booking__ds__year + , subq_17.booking__ds__extract_year + , subq_17.booking__ds__extract_quarter + , subq_17.booking__ds__extract_month + , subq_17.booking__ds__extract_week + , subq_17.booking__ds__extract_day + , subq_17.booking__ds__extract_dayofweek + , subq_17.booking__ds__extract_dayofyear , subq_17.booking__ds_partitioned__day , subq_17.booking__ds_partitioned__week , subq_17.booking__ds_partitioned__month , subq_17.booking__ds_partitioned__quarter , subq_17.booking__ds_partitioned__year + , subq_17.booking__ds_partitioned__extract_year + , subq_17.booking__ds_partitioned__extract_quarter + , subq_17.booking__ds_partitioned__extract_month + , subq_17.booking__ds_partitioned__extract_week + , subq_17.booking__ds_partitioned__extract_day + , subq_17.booking__ds_partitioned__extract_dayofweek + , subq_17.booking__ds_partitioned__extract_dayofyear , subq_17.booking__paid_at__day , subq_17.booking__paid_at__week , subq_17.booking__paid_at__month , subq_17.booking__paid_at__quarter , subq_17.booking__paid_at__year + , subq_17.booking__paid_at__extract_year + , subq_17.booking__paid_at__extract_quarter + , subq_17.booking__paid_at__extract_month + , subq_17.booking__paid_at__extract_week + , subq_17.booking__paid_at__extract_day + , subq_17.booking__paid_at__extract_dayofweek + , subq_17.booking__paid_at__extract_dayofyear , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month @@ -554,32 +848,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql index be96decab5..3ada9bf35a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql @@ -45,32 +45,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql index a5288e7009..e7c3deecdb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.verification__ds__day , subq_0.verification__ds__week , subq_0.verification__ds__month , subq_0.verification__ds__quarter , subq_0.verification__ds__year + , subq_0.verification__ds__extract_year + , subq_0.verification__ds__extract_quarter + , subq_0.verification__ds__extract_month + , subq_0.verification__ds__extract_week + , subq_0.verification__ds__extract_day + , subq_0.verification__ds__extract_dayofweek + , subq_0.verification__ds__extract_dayofyear , subq_0.verification__ds_partitioned__day , subq_0.verification__ds_partitioned__week , subq_0.verification__ds_partitioned__month , subq_0.verification__ds_partitioned__quarter , subq_0.verification__ds_partitioned__year + , subq_0.verification__ds_partitioned__extract_year + , subq_0.verification__ds_partitioned__extract_quarter + , subq_0.verification__ds_partitioned__extract_month + , subq_0.verification__ds_partitioned__extract_week + , subq_0.verification__ds_partitioned__extract_day + , subq_0.verification__ds_partitioned__extract_dayofweek + , subq_0.verification__ds_partitioned__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -71,22 +99,50 @@ FROM ( , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user @@ -110,32 +166,74 @@ FROM ( , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM users_ds_source_src_10007.ds) AS ds__extract_dayofyear , users_ds_source_src_10007.created_at AS created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state , users_ds_source_src_10007.ds AS user__ds__day , DATE_TRUNC('week', users_ds_source_src_10007.ds) AS user__ds__week , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS user__ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS user__ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofweek + , EXTRACT(DOY FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofyear , users_ds_source_src_10007.created_at AS user__created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS user__created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS user__created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS user__created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS user__created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofweek + , EXTRACT(DOY FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state AS user__home_state , users_ds_source_src_10007.user_id AS user FROM ***************************.dim_users users_ds_source_src_10007 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql index c65a58a300..f26bd34521 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -54,12 +82,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql index 603dac8609..0e5972d3ea 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql index adfa1c3f03..fa1d4a6720 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 48a1b43de5..3c78b2147d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 08a913aa57..3dcd0390ef 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index ed796b148d..e722f24125 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql index 782ccc2826..e2cc098fae 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -83,11 +125,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -96,11 +152,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DOY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql index 0f449eb59e..e337bd9061 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql index ee19129508..82a5abe48e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM paid_at) AS paid_at__extract_dayofyear , is_instant AS booking__is_instant , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM paid_at) AS booking__paid_at__extract_dayofyear , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql index 214766cb17..073c7964da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_common_semantic_model__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -239,32 +365,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql index 63637a9433..c80b16baf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 9c4d91d069..d5d52443ea 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -51,31 +51,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -125,32 +167,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -175,21 +259,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -218,11 +330,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -231,11 +357,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -296,21 +436,49 @@ FROM ( , subq_10.ds__month , subq_10.ds__quarter , subq_10.ds__year + , subq_10.ds__extract_year + , subq_10.ds__extract_quarter + , subq_10.ds__extract_month + , subq_10.ds__extract_week + , subq_10.ds__extract_day + , subq_10.ds__extract_dayofweek + , subq_10.ds__extract_dayofyear , subq_10.ds_partitioned__day , subq_10.ds_partitioned__week , subq_10.ds_partitioned__month , subq_10.ds_partitioned__quarter , subq_10.ds_partitioned__year + , subq_10.ds_partitioned__extract_year + , subq_10.ds_partitioned__extract_quarter + , subq_10.ds_partitioned__extract_month + , subq_10.ds_partitioned__extract_week + , subq_10.ds_partitioned__extract_day + , subq_10.ds_partitioned__extract_dayofweek + , subq_10.ds_partitioned__extract_dayofyear , subq_10.view__ds__day , subq_10.view__ds__week , subq_10.view__ds__month , subq_10.view__ds__quarter , subq_10.view__ds__year + , subq_10.view__ds__extract_year + , subq_10.view__ds__extract_quarter + , subq_10.view__ds__extract_month + , subq_10.view__ds__extract_week + , subq_10.view__ds__extract_day + , subq_10.view__ds__extract_dayofweek + , subq_10.view__ds__extract_dayofyear , subq_10.view__ds_partitioned__day , subq_10.view__ds_partitioned__week , subq_10.view__ds_partitioned__month , subq_10.view__ds_partitioned__quarter , subq_10.view__ds_partitioned__year + , subq_10.view__ds_partitioned__extract_year + , subq_10.view__ds_partitioned__extract_quarter + , subq_10.view__ds_partitioned__extract_month + , subq_10.view__ds_partitioned__extract_week + , subq_10.view__ds_partitioned__extract_day + , subq_10.view__ds_partitioned__extract_dayofweek + , subq_10.view__ds_partitioned__extract_dayofyear , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month @@ -330,21 +498,49 @@ FROM ( , DATE_TRUNC('month', views_source_src_10009.ds) AS ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofyear , views_source_src_10009.ds AS view__ds__day , DATE_TRUNC('week', views_source_src_10009.ds) AS view__ds__week , DATE_TRUNC('month', views_source_src_10009.ds) AS view__ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS view__ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS view__ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS view__ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS view__ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS view__ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS view__ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS view__ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS view__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS view__ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS view__ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofyear , views_source_src_10009.listing_id AS listing , views_source_src_10009.user_id AS user , views_source_src_10009.listing_id AS view__listing @@ -367,21 +563,49 @@ FROM ( , subq_13.ds__month , subq_13.ds__quarter , subq_13.ds__year + , subq_13.ds__extract_year + , subq_13.ds__extract_quarter + , subq_13.ds__extract_month + , subq_13.ds__extract_week + , subq_13.ds__extract_day + , subq_13.ds__extract_dayofweek + , subq_13.ds__extract_dayofyear , subq_13.created_at__day , subq_13.created_at__week , subq_13.created_at__month , subq_13.created_at__quarter , subq_13.created_at__year + , subq_13.created_at__extract_year + , subq_13.created_at__extract_quarter + , subq_13.created_at__extract_month + , subq_13.created_at__extract_week + , subq_13.created_at__extract_day + , subq_13.created_at__extract_dayofweek + , subq_13.created_at__extract_dayofyear , subq_13.listing__ds__day , subq_13.listing__ds__week , subq_13.listing__ds__month , subq_13.listing__ds__quarter , subq_13.listing__ds__year + , subq_13.listing__ds__extract_year + , subq_13.listing__ds__extract_quarter + , subq_13.listing__ds__extract_month + , subq_13.listing__ds__extract_week + , subq_13.listing__ds__extract_day + , subq_13.listing__ds__extract_dayofweek + , subq_13.listing__ds__extract_dayofyear , subq_13.listing__created_at__day , subq_13.listing__created_at__week , subq_13.listing__created_at__month , subq_13.listing__created_at__quarter , subq_13.listing__created_at__year + , subq_13.listing__created_at__extract_year + , subq_13.listing__created_at__extract_quarter + , subq_13.listing__created_at__extract_month + , subq_13.listing__created_at__extract_week + , subq_13.listing__created_at__extract_day + , subq_13.listing__created_at__extract_dayofweek + , subq_13.listing__created_at__extract_dayofyear , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month @@ -410,11 +634,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -423,11 +661,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index dd55a54b61..a56183e745 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -47,32 +47,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -99,11 +141,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -112,11 +168,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql index 48583b238a..b6f01861d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql index 4ca35f2544..d480357663 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql @@ -38,32 +38,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql index b515ad2da5..f52c8d6acf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql index 5eb893b84a..4e79154b70 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql index 2393630095..f44071348d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql @@ -18,11 +18,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -40,11 +54,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql index 9ced88e0cc..4c321e73b0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index dd00d2b15e..4821d797fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql index 658dcf3357..2a39c9282f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql index 9bafb5e1f6..82ded0a878 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -170,31 +254,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -244,32 +370,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql index edbbe545fd..f21c6e33a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index c97b8fd930..34b929887f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql index bbc8999a91..de24654075 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql index f9871f024a..3da362bd96 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 5906b2b836..001633ef6d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -235,31 +361,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,31 +463,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -369,32 +579,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index f8f4db398a..0d2a73ccaa 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -236,31 +362,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,31 +464,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -370,32 +580,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql index b0135c14b3..11133f2d42 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_4.ds__month AS ds__month , subq_4.ds__quarter AS ds__quarter , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_week AS ds__extract_week + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_4.ds__extract_dayofyear AS ds__extract_dayofyear , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , subq_4.ds_partitioned__year AS ds_partitioned__year + , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_4.paid_at__day AS paid_at__day , subq_4.paid_at__week AS paid_at__week , subq_4.paid_at__month AS paid_at__month , subq_4.paid_at__quarter AS paid_at__quarter , subq_4.paid_at__year AS paid_at__year + , subq_4.paid_at__extract_year AS paid_at__extract_year + , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_4.paid_at__extract_month AS paid_at__extract_month + , subq_4.paid_at__extract_week AS paid_at__extract_week + , subq_4.paid_at__extract_day AS paid_at__extract_day + , subq_4.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_4.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_4.booking__ds__day AS booking__ds__day , subq_4.booking__ds__week AS booking__ds__week , subq_4.booking__ds__month AS booking__ds__month , subq_4.booking__ds__quarter AS booking__ds__quarter , subq_4.booking__ds__year AS booking__ds__year + , subq_4.booking__ds__extract_year AS booking__ds__extract_year + , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_4.booking__ds__extract_month AS booking__ds__extract_month + , subq_4.booking__ds__extract_week AS booking__ds__extract_week + , subq_4.booking__ds__extract_day AS booking__ds__extract_day + , subq_4.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_4.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_4.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_4.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_4.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_4.booking__paid_at__day AS booking__paid_at__day , subq_4.booking__paid_at__week AS booking__paid_at__week , subq_4.booking__paid_at__month AS booking__paid_at__month , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter , subq_4.booking__paid_at__year AS booking__paid_at__year + , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_4.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_4.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_4.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,31 +130,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , 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 @@ -152,31 +236,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -226,32 +352,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql index f9062ca85f..467707f734 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,31 +129,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -161,32 +245,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql index 870b2c80ea..3adff18e62 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_distinct_values__plan0.sql @@ -42,31 +42,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -116,32 +158,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -166,21 +250,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -209,11 +321,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -222,11 +348,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql index ddba65921c..00efad0383 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql @@ -25,32 +25,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql index 7ce1a71c7f..7e0fdff19e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql index 81e6d39ada..eb70f04221 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -48,31 +48,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -122,32 +164,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -172,21 +256,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -215,11 +327,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -228,11 +354,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql index 4caa3d07f0..3adabb04a0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql @@ -30,7 +30,7 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_4.window_start__day AS listing__window_start__day + , subq_4.window_start__extract_day AS listing__window_start__extract_day , subq_4.window_end__day AS listing__window_end__day , subq_2.listing AS listing , subq_4.capacity AS listing__capacity @@ -50,31 +50,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -110,32 +152,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -152,7 +236,7 @@ FROM ( -- Pass Only Elements: -- ['capacity', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_3.window_start__day + subq_3.window_start__extract_day , subq_3.window_end__day , subq_3.listing , subq_3.capacity @@ -164,11 +248,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +275,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -196,7 +308,7 @@ FROM ( subq_2.listing = subq_4.listing ) AND ( ( - subq_2.metric_time__day >= subq_4.window_start__day + subq_2.metric_time__day >= subq_4.window_start__extract_day ) AND ( ( subq_2.metric_time__day < subq_4.window_end__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql index 86a2010b35..ef3f381d35 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0_optimized.sql @@ -32,7 +32,7 @@ FROM ( subq_12.listing = listings_src_10017.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10017.active_from + subq_12.metric_time__day >= EXTRACT(DAY FROM listings_src_10017.active_from) ) AND ( ( subq_12.metric_time__day < listings_src_10017.active_to diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 6ed1bd4e99..6ef8853985 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql index 0834ca012d..18e509dd5c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql index 027f20ea5b..16e8afe8d0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql index 913fed793c..b00d690648 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_limit_rows__plan0.sql @@ -26,31 +26,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql index 86b30c4553..583b4a4bf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_local_dimension_using_local_entity__plan0.sql @@ -21,21 +21,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.created_at__day , subq_0.created_at__week , subq_0.created_at__month , subq_0.created_at__quarter , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_week + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dayofweek + , subq_0.created_at__extract_dayofyear , subq_0.listing__ds__day , subq_0.listing__ds__week , subq_0.listing__ds__month , subq_0.listing__ds__quarter , subq_0.listing__ds__year + , subq_0.listing__ds__extract_year + , subq_0.listing__ds__extract_quarter + , subq_0.listing__ds__extract_month + , subq_0.listing__ds__extract_week + , subq_0.listing__ds__extract_day + , subq_0.listing__ds__extract_dayofweek + , subq_0.listing__ds__extract_dayofyear , subq_0.listing__created_at__day , subq_0.listing__created_at__week , subq_0.listing__created_at__month , subq_0.listing__created_at__quarter , subq_0.listing__created_at__year + , subq_0.listing__created_at__extract_year + , subq_0.listing__created_at__extract_quarter + , subq_0.listing__created_at__extract_month + , subq_0.listing__created_at__extract_week + , subq_0.listing__created_at__extract_day + , subq_0.listing__created_at__extract_dayofweek + , subq_0.listing__created_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -77,11 +119,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql index 316737d00a..b05da97264 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql @@ -35,32 +35,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql index 73e6a70d92..437dc887b4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql @@ -60,31 +60,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -134,32 +176,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -184,21 +268,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -227,11 +339,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -240,11 +366,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -317,31 +457,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -391,32 +573,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -441,21 +665,49 @@ FROM ( , subq_15.ds__month , subq_15.ds__quarter , subq_15.ds__year + , subq_15.ds__extract_year + , subq_15.ds__extract_quarter + , subq_15.ds__extract_month + , subq_15.ds__extract_week + , subq_15.ds__extract_day + , subq_15.ds__extract_dayofweek + , subq_15.ds__extract_dayofyear , subq_15.created_at__day , subq_15.created_at__week , subq_15.created_at__month , subq_15.created_at__quarter , subq_15.created_at__year + , subq_15.created_at__extract_year + , subq_15.created_at__extract_quarter + , subq_15.created_at__extract_month + , subq_15.created_at__extract_week + , subq_15.created_at__extract_day + , subq_15.created_at__extract_dayofweek + , subq_15.created_at__extract_dayofyear , subq_15.listing__ds__day , subq_15.listing__ds__week , subq_15.listing__ds__month , subq_15.listing__ds__quarter , subq_15.listing__ds__year + , subq_15.listing__ds__extract_year + , subq_15.listing__ds__extract_quarter + , subq_15.listing__ds__extract_month + , subq_15.listing__ds__extract_week + , subq_15.listing__ds__extract_day + , subq_15.listing__ds__extract_dayofweek + , subq_15.listing__ds__extract_dayofyear , subq_15.listing__created_at__day , subq_15.listing__created_at__week , subq_15.listing__created_at__month , subq_15.listing__created_at__quarter , subq_15.listing__created_at__year + , subq_15.listing__created_at__extract_year + , subq_15.listing__created_at__extract_quarter + , subq_15.listing__created_at__extract_month + , subq_15.listing__created_at__extract_week + , subq_15.listing__created_at__extract_day + , subq_15.listing__created_at__extract_dayofweek + , subq_15.listing__created_at__extract_dayofyear , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month @@ -484,11 +736,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -497,11 +763,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -557,31 +837,73 @@ FROM ( , subq_24.ds__month , subq_24.ds__quarter , subq_24.ds__year + , subq_24.ds__extract_year + , subq_24.ds__extract_quarter + , subq_24.ds__extract_month + , subq_24.ds__extract_week + , subq_24.ds__extract_day + , subq_24.ds__extract_dayofweek + , subq_24.ds__extract_dayofyear , subq_24.ds_partitioned__day , subq_24.ds_partitioned__week , subq_24.ds_partitioned__month , subq_24.ds_partitioned__quarter , subq_24.ds_partitioned__year + , subq_24.ds_partitioned__extract_year + , subq_24.ds_partitioned__extract_quarter + , subq_24.ds_partitioned__extract_month + , subq_24.ds_partitioned__extract_week + , subq_24.ds_partitioned__extract_day + , subq_24.ds_partitioned__extract_dayofweek + , subq_24.ds_partitioned__extract_dayofyear , subq_24.paid_at__day , subq_24.paid_at__week , subq_24.paid_at__month , subq_24.paid_at__quarter , subq_24.paid_at__year + , subq_24.paid_at__extract_year + , subq_24.paid_at__extract_quarter + , subq_24.paid_at__extract_month + , subq_24.paid_at__extract_week + , subq_24.paid_at__extract_day + , subq_24.paid_at__extract_dayofweek + , subq_24.paid_at__extract_dayofyear , subq_24.booking__ds__day , subq_24.booking__ds__week , subq_24.booking__ds__month , subq_24.booking__ds__quarter , subq_24.booking__ds__year + , subq_24.booking__ds__extract_year + , subq_24.booking__ds__extract_quarter + , subq_24.booking__ds__extract_month + , subq_24.booking__ds__extract_week + , subq_24.booking__ds__extract_day + , subq_24.booking__ds__extract_dayofweek + , subq_24.booking__ds__extract_dayofyear , subq_24.booking__ds_partitioned__day , subq_24.booking__ds_partitioned__week , subq_24.booking__ds_partitioned__month , subq_24.booking__ds_partitioned__quarter , subq_24.booking__ds_partitioned__year + , subq_24.booking__ds_partitioned__extract_year + , subq_24.booking__ds_partitioned__extract_quarter + , subq_24.booking__ds_partitioned__extract_month + , subq_24.booking__ds_partitioned__extract_week + , subq_24.booking__ds_partitioned__extract_day + , subq_24.booking__ds_partitioned__extract_dayofweek + , subq_24.booking__ds_partitioned__extract_dayofyear , subq_24.booking__paid_at__day , subq_24.booking__paid_at__week , subq_24.booking__paid_at__month , subq_24.booking__paid_at__quarter , subq_24.booking__paid_at__year + , subq_24.booking__paid_at__extract_year + , subq_24.booking__paid_at__extract_quarter + , subq_24.booking__paid_at__extract_month + , subq_24.booking__paid_at__extract_week + , subq_24.booking__paid_at__extract_day + , subq_24.booking__paid_at__extract_dayofweek + , subq_24.booking__paid_at__extract_dayofyear , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month @@ -631,32 +953,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql index 4176ca90e9..37ad3a608e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0.sql @@ -45,31 +45,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -119,32 +161,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -186,31 +270,73 @@ FROM ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.ds_partitioned__day , subq_7.ds_partitioned__week , subq_7.ds_partitioned__month , subq_7.ds_partitioned__quarter , subq_7.ds_partitioned__year + , subq_7.ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_week + , subq_7.ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dayofweek + , subq_7.ds_partitioned__extract_dayofyear , subq_7.paid_at__day , subq_7.paid_at__week , subq_7.paid_at__month , subq_7.paid_at__quarter , subq_7.paid_at__year + , subq_7.paid_at__extract_year + , subq_7.paid_at__extract_quarter + , subq_7.paid_at__extract_month + , subq_7.paid_at__extract_week + , subq_7.paid_at__extract_day + , subq_7.paid_at__extract_dayofweek + , subq_7.paid_at__extract_dayofyear , subq_7.booking__ds__day , subq_7.booking__ds__week , subq_7.booking__ds__month , subq_7.booking__ds__quarter , subq_7.booking__ds__year + , subq_7.booking__ds__extract_year + , subq_7.booking__ds__extract_quarter + , subq_7.booking__ds__extract_month + , subq_7.booking__ds__extract_week + , subq_7.booking__ds__extract_day + , subq_7.booking__ds__extract_dayofweek + , subq_7.booking__ds__extract_dayofyear , subq_7.booking__ds_partitioned__day , subq_7.booking__ds_partitioned__week , subq_7.booking__ds_partitioned__month , subq_7.booking__ds_partitioned__quarter , subq_7.booking__ds_partitioned__year + , subq_7.booking__ds_partitioned__extract_year + , subq_7.booking__ds_partitioned__extract_quarter + , subq_7.booking__ds_partitioned__extract_month + , subq_7.booking__ds_partitioned__extract_week + , subq_7.booking__ds_partitioned__extract_day + , subq_7.booking__ds_partitioned__extract_dayofweek + , subq_7.booking__ds_partitioned__extract_dayofyear , subq_7.booking__paid_at__day , subq_7.booking__paid_at__week , subq_7.booking__paid_at__month , subq_7.booking__paid_at__quarter , subq_7.booking__paid_at__year + , subq_7.booking__paid_at__extract_year + , subq_7.booking__paid_at__extract_quarter + , subq_7.booking__paid_at__extract_month + , subq_7.booking__paid_at__extract_week + , subq_7.booking__paid_at__extract_day + , subq_7.booking__paid_at__extract_dayofweek + , subq_7.booking__paid_at__extract_dayofyear , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month @@ -260,32 +386,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 13d80a91d0..a495423238 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -39,31 +39,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -113,32 +155,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 14ec230f17..0e4cdb1a6a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -160,21 +244,49 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.created_at__day , subq_5.created_at__week , subq_5.created_at__month , subq_5.created_at__quarter , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_week + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dayofweek + , subq_5.created_at__extract_dayofyear , subq_5.listing__ds__day , subq_5.listing__ds__week , subq_5.listing__ds__month , subq_5.listing__ds__quarter , subq_5.listing__ds__year + , subq_5.listing__ds__extract_year + , subq_5.listing__ds__extract_quarter + , subq_5.listing__ds__extract_month + , subq_5.listing__ds__extract_week + , subq_5.listing__ds__extract_day + , subq_5.listing__ds__extract_dayofweek + , subq_5.listing__ds__extract_dayofyear , subq_5.listing__created_at__day , subq_5.listing__created_at__week , subq_5.listing__created_at__month , subq_5.listing__created_at__quarter , subq_5.listing__created_at__year + , subq_5.listing__created_at__extract_year + , subq_5.listing__created_at__extract_quarter + , subq_5.listing__created_at__extract_month + , subq_5.listing__created_at__extract_week + , subq_5.listing__created_at__extract_day + , subq_5.listing__created_at__extract_dayofweek + , subq_5.listing__created_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -203,11 +315,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -216,11 +342,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql index 88cc0b431d..bae75b4fc0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql @@ -20,7 +20,7 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.window_start__day AS listing__window_start__day + , subq_7.window_start__extract_day AS listing__window_start__extract_day , subq_7.window_end__day AS listing__window_end__day , subq_2.listing AS listing , subq_7.user__home_state_latest AS listing__user__home_state_latest @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -142,7 +226,7 @@ FROM ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_6.window_start__day + subq_6.window_start__extract_day , subq_6.window_end__day , subq_6.listing , subq_6.user__home_state_latest @@ -154,26 +238,61 @@ FROM ( , subq_3.window_start__month AS window_start__month , subq_3.window_start__quarter AS window_start__quarter , subq_3.window_start__year AS window_start__year + , subq_3.window_start__extract_year AS window_start__extract_year + , subq_3.window_start__extract_quarter AS window_start__extract_quarter + , subq_3.window_start__extract_month AS window_start__extract_month + , subq_3.window_start__extract_week AS window_start__extract_week + , subq_3.window_start__extract_day AS window_start__extract_day + , subq_3.window_start__extract_dayofweek AS window_start__extract_dayofweek + , subq_3.window_start__extract_dayofyear AS window_start__extract_dayofyear , subq_3.window_end__day AS window_end__day , subq_3.window_end__week AS window_end__week , subq_3.window_end__month AS window_end__month , subq_3.window_end__quarter AS window_end__quarter , subq_3.window_end__year AS window_end__year + , subq_3.window_end__extract_year AS window_end__extract_year + , subq_3.window_end__extract_quarter AS window_end__extract_quarter + , subq_3.window_end__extract_month AS window_end__extract_month + , subq_3.window_end__extract_week AS window_end__extract_week + , subq_3.window_end__extract_day AS window_end__extract_day + , subq_3.window_end__extract_dayofweek AS window_end__extract_dayofweek + , subq_3.window_end__extract_dayofyear AS window_end__extract_dayofyear , subq_3.listing__window_start__day AS listing__window_start__day , subq_3.listing__window_start__week AS listing__window_start__week , subq_3.listing__window_start__month AS listing__window_start__month , subq_3.listing__window_start__quarter AS listing__window_start__quarter , subq_3.listing__window_start__year AS listing__window_start__year + , subq_3.listing__window_start__extract_year AS listing__window_start__extract_year + , subq_3.listing__window_start__extract_quarter AS listing__window_start__extract_quarter + , subq_3.listing__window_start__extract_month AS listing__window_start__extract_month + , subq_3.listing__window_start__extract_week AS listing__window_start__extract_week + , subq_3.listing__window_start__extract_day AS listing__window_start__extract_day + , subq_3.listing__window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_3.listing__window_start__extract_dayofyear AS listing__window_start__extract_dayofyear , subq_3.listing__window_end__day AS listing__window_end__day , subq_3.listing__window_end__week AS listing__window_end__week , subq_3.listing__window_end__month AS listing__window_end__month , subq_3.listing__window_end__quarter AS listing__window_end__quarter , subq_3.listing__window_end__year AS listing__window_end__year + , subq_3.listing__window_end__extract_year AS listing__window_end__extract_year + , subq_3.listing__window_end__extract_quarter AS listing__window_end__extract_quarter + , subq_3.listing__window_end__extract_month AS listing__window_end__extract_month + , subq_3.listing__window_end__extract_week AS listing__window_end__extract_week + , subq_3.listing__window_end__extract_day AS listing__window_end__extract_day + , subq_3.listing__window_end__extract_dayofweek AS listing__window_end__extract_dayofweek + , subq_3.listing__window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dayofweek AS user__ds__extract_dayofweek + , subq_5.ds__extract_dayofyear AS user__ds__extract_dayofyear , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +311,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +338,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -227,11 +374,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +400,25 @@ FROM ( , subq_4.ds__month , subq_4.ds__quarter , subq_4.ds__year + , subq_4.ds__extract_year + , subq_4.ds__extract_quarter + , subq_4.ds__extract_month + , subq_4.ds__extract_week + , subq_4.ds__extract_day + , subq_4.ds__extract_dayofweek + , subq_4.ds__extract_dayofyear , subq_4.user__ds__day , subq_4.user__ds__week , subq_4.user__ds__month , subq_4.user__ds__quarter , subq_4.user__ds__year + , subq_4.user__ds__extract_year + , subq_4.user__ds__extract_quarter + , subq_4.user__ds__extract_month + , subq_4.user__ds__extract_week + , subq_4.user__ds__extract_day + , subq_4.user__ds__extract_dayofweek + , subq_4.user__ds__extract_dayofyear , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +430,26 @@ FROM ( , DATE_TRUNC('month', users_latest_src_10021.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS ds__extract_dayofyear , users_latest_src_10021.home_state_latest , users_latest_src_10021.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10021.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10021.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS user__ds__extract_dayofyear , users_latest_src_10021.home_state_latest AS user__home_state_latest , users_latest_src_10021.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10021 @@ -275,7 +464,7 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.window_start__day + subq_2.metric_time__day >= subq_7.window_start__extract_day ) AND ( ( subq_2.metric_time__day < subq_7.window_end__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql index feb5ed0fdc..fdc48352dd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -23,7 +23,7 @@ LEFT OUTER JOIN ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10017.active_from AS window_start__day + EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day , listings_src_10017.active_to AS window_end__day , listings_src_10017.listing_id AS listing , users_latest_src_10021.home_state_latest AS user__home_state_latest @@ -38,7 +38,7 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.window_start__day + subq_13.metric_time__day >= subq_18.window_start__extract_day ) AND ( ( subq_13.metric_time__day < subq_18.window_end__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql index 94054a124c..6d8641dc18 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.lux_listing__window_start__day AS listing__lux_listing__window_start__day - , subq_7.lux_listing__window_end__day AS listing__lux_listing__window_end__day + , subq_7.lux_listing__window_start__extract_month AS listing__lux_listing__window_start__extract_month + , subq_7.lux_listing__window_end__extract_quarter AS listing__lux_listing__window_end__extract_quarter , subq_2.listing AS listing , subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -145,8 +229,8 @@ FROM ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - subq_6.lux_listing__window_start__day - , subq_6.lux_listing__window_end__day + subq_6.lux_listing__window_start__extract_month + , subq_6.lux_listing__window_end__extract_quarter , subq_6.listing , subq_6.lux_listing__is_confirmed_lux FROM ( @@ -157,11 +241,25 @@ FROM ( , subq_5.window_start__month AS lux_listing__window_start__month , subq_5.window_start__quarter AS lux_listing__window_start__quarter , subq_5.window_start__year AS lux_listing__window_start__year + , subq_5.window_start__extract_year AS lux_listing__window_start__extract_year + , subq_5.window_start__extract_quarter AS lux_listing__window_start__extract_quarter + , subq_5.window_start__extract_month AS lux_listing__window_start__extract_month + , subq_5.window_start__extract_week AS lux_listing__window_start__extract_week + , subq_5.window_start__extract_day AS lux_listing__window_start__extract_day + , subq_5.window_start__extract_dayofweek AS lux_listing__window_start__extract_dayofweek + , subq_5.window_start__extract_dayofyear AS lux_listing__window_start__extract_dayofyear , subq_5.window_end__day AS lux_listing__window_end__day , subq_5.window_end__week AS lux_listing__window_end__week , subq_5.window_end__month AS lux_listing__window_end__month , subq_5.window_end__quarter AS lux_listing__window_end__quarter , subq_5.window_end__year AS lux_listing__window_end__year + , subq_5.window_end__extract_year AS lux_listing__window_end__extract_year + , subq_5.window_end__extract_quarter AS lux_listing__window_end__extract_quarter + , subq_5.window_end__extract_month AS lux_listing__window_end__extract_month + , subq_5.window_end__extract_week AS lux_listing__window_end__extract_week + , subq_5.window_end__extract_day AS lux_listing__window_end__extract_day + , subq_5.window_end__extract_dayofweek AS lux_listing__window_end__extract_dayofweek + , subq_5.window_end__extract_dayofyear AS lux_listing__window_end__extract_dayofyear , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +281,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +331,49 @@ FROM ( , subq_4.window_start__month , subq_4.window_start__quarter , subq_4.window_start__year + , subq_4.window_start__extract_year + , subq_4.window_start__extract_quarter + , subq_4.window_start__extract_month + , subq_4.window_start__extract_week + , subq_4.window_start__extract_day + , subq_4.window_start__extract_dayofweek + , subq_4.window_start__extract_dayofyear , subq_4.window_end__day , subq_4.window_end__week , subq_4.window_end__month , subq_4.window_end__quarter , subq_4.window_end__year + , subq_4.window_end__extract_year + , subq_4.window_end__extract_quarter + , subq_4.window_end__extract_month + , subq_4.window_end__extract_week + , subq_4.window_end__extract_day + , subq_4.window_end__extract_dayofweek + , subq_4.window_end__extract_dayofyear , subq_4.lux_listing__window_start__day , subq_4.lux_listing__window_start__week , subq_4.lux_listing__window_start__month , subq_4.lux_listing__window_start__quarter , subq_4.lux_listing__window_start__year + , subq_4.lux_listing__window_start__extract_year + , subq_4.lux_listing__window_start__extract_quarter + , subq_4.lux_listing__window_start__extract_month + , subq_4.lux_listing__window_start__extract_week + , subq_4.lux_listing__window_start__extract_day + , subq_4.lux_listing__window_start__extract_dayofweek + , subq_4.lux_listing__window_start__extract_dayofyear , subq_4.lux_listing__window_end__day , subq_4.lux_listing__window_end__week , subq_4.lux_listing__window_end__month , subq_4.lux_listing__window_end__quarter , subq_4.lux_listing__window_end__year + , subq_4.lux_listing__window_end__extract_year + , subq_4.lux_listing__window_end__extract_quarter + , subq_4.lux_listing__window_end__extract_month + , subq_4.lux_listing__window_end__extract_week + , subq_4.lux_listing__window_end__extract_day + , subq_4.lux_listing__window_end__extract_dayofweek + , subq_4.lux_listing__window_end__extract_dayofyear , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +385,50 @@ FROM ( , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux , lux_listings_src_10019.valid_from AS lux_listing__window_start__day , DATE_TRUNC('week', lux_listings_src_10019.valid_from) AS lux_listing__window_start__week , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS lux_listing__window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS lux_listing__window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS lux_listing__window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS lux_listing__window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS lux_listing__window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS lux_listing__window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS lux_listing__window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS lux_listing__window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux , lux_listings_src_10019.lux_listing_id AS lux_listing FROM ***************************.dim_lux_listings lux_listings_src_10019 @@ -261,12 +443,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.lux_listing__window_start__day + subq_2.metric_time__day >= subq_7.lux_listing__window_start__extract_month ) AND ( ( - subq_2.metric_time__day < subq_7.lux_listing__window_end__day + subq_2.metric_time__day < subq_7.lux_listing__window_end__extract_quarter ) OR ( - subq_7.lux_listing__window_end__day IS NULL + subq_7.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql index f1b419a284..742f3f4f2a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -26,8 +26,8 @@ LEFT OUTER JOIN ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - lux_listings_src_10019.valid_from AS lux_listing__window_start__day - , lux_listings_src_10019.valid_to AS lux_listing__window_end__day + EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter , lux_listing_mapping_src_10018.listing_id AS listing , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10018 @@ -41,12 +41,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.lux_listing__window_start__day + subq_13.metric_time__day >= subq_18.lux_listing__window_start__extract_month ) AND ( ( - subq_13.metric_time__day < subq_18.lux_listing__window_end__day + subq_13.metric_time__day < subq_18.lux_listing__window_end__extract_quarter ) OR ( - subq_18.lux_listing__window_end__day IS NULL + subq_18.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql index ae8b7838b7..cb9670f074 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql @@ -33,32 +33,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -85,11 +127,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -98,11 +154,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -131,11 +201,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -144,11 +228,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql index d35179ebf0..fbddd59f54 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.ds__day , subq_0.ds__week , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.account_id__ds_partitioned__day , subq_0.account_id__ds_partitioned__week , subq_0.account_id__ds_partitioned__month , subq_0.account_id__ds_partitioned__quarter , subq_0.account_id__ds_partitioned__year + , subq_0.account_id__ds_partitioned__extract_year + , subq_0.account_id__ds_partitioned__extract_quarter + , subq_0.account_id__ds_partitioned__extract_month + , subq_0.account_id__ds_partitioned__extract_week + , subq_0.account_id__ds_partitioned__extract_day + , subq_0.account_id__ds_partitioned__extract_dayofweek + , subq_0.account_id__ds_partitioned__extract_dayofyear , subq_0.account_id__ds__day , subq_0.account_id__ds__week , subq_0.account_id__ds__month , subq_0.account_id__ds__quarter , subq_0.account_id__ds__year + , subq_0.account_id__ds__extract_year + , subq_0.account_id__ds__extract_quarter + , subq_0.account_id__ds__extract_month + , subq_0.account_id__ds__extract_week + , subq_0.account_id__ds__extract_day + , subq_0.account_id__ds__extract_dayofweek + , subq_0.account_id__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -69,22 +97,50 @@ FROM ( , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS ds__extract_dayofyear , account_month_txns_src_10010.account_month , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS account_id__ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS account_id__ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS account_id__ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS account_id__ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS account_id__ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofyear , account_month_txns_src_10010.account_month AS account_id__account_month , account_month_txns_src_10010.account_id FROM ***************************.account_month_txns account_month_txns_src_10010 @@ -106,16 +162,37 @@ FROM ( , subq_3.ds_partitioned__month AS ds_partitioned__month , subq_3.ds_partitioned__quarter AS ds_partitioned__quarter , subq_3.ds_partitioned__year AS ds_partitioned__year + , subq_3.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_3.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_3.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_3.account_id__ds_partitioned__day AS account_id__ds_partitioned__day , subq_3.account_id__ds_partitioned__week AS account_id__ds_partitioned__week , subq_3.account_id__ds_partitioned__month AS account_id__ds_partitioned__month , subq_3.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter , subq_3.account_id__ds_partitioned__year AS account_id__ds_partitioned__year + , subq_3.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year + , subq_3.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter + , subq_3.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month + , subq_3.account_id__ds_partitioned__extract_week AS account_id__ds_partitioned__extract_week + , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day + , subq_3.account_id__ds_partitioned__extract_dayofweek AS account_id__ds_partitioned__extract_dayofweek + , subq_3.account_id__ds_partitioned__extract_dayofyear AS account_id__ds_partitioned__extract_dayofyear , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month , subq_5.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter , subq_5.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_5.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week AS customer_id__ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek AS customer_id__ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear AS customer_id__ds_partitioned__extract_dayofyear , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id @@ -132,12 +209,26 @@ FROM ( , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofyear , bridge_table_src_10011.extra_dim AS account_id__extra_dim , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id @@ -154,11 +245,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +271,25 @@ FROM ( , subq_4.ds_partitioned__month , subq_4.ds_partitioned__quarter , subq_4.ds_partitioned__year + , subq_4.ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear , subq_4.customer_id__ds_partitioned__day , subq_4.customer_id__ds_partitioned__week , subq_4.customer_id__ds_partitioned__month , subq_4.customer_id__ds_partitioned__quarter , subq_4.customer_id__ds_partitioned__year + , subq_4.customer_id__ds_partitioned__extract_year + , subq_4.customer_id__ds_partitioned__extract_quarter + , subq_4.customer_id__ds_partitioned__extract_month + , subq_4.customer_id__ds_partitioned__extract_week + , subq_4.customer_id__ds_partitioned__extract_day + , subq_4.customer_id__ds_partitioned__extract_dayofweek + , subq_4.customer_id__ds_partitioned__extract_dayofyear , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +305,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_name AS customer_id__customer_name , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned__day @@ -193,6 +319,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_id FROM ***************************.customer_table customer_table_src_10013 ) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql index 5c9089deaf..eb31a4fb3a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multiple_metrics_no_dimensions__plan0.sql @@ -23,31 +23,73 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.ds_partitioned__day , subq_1.ds_partitioned__week , subq_1.ds_partitioned__month , subq_1.ds_partitioned__quarter , subq_1.ds_partitioned__year + , subq_1.ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear , subq_1.paid_at__day , subq_1.paid_at__week , subq_1.paid_at__month , subq_1.paid_at__quarter , subq_1.paid_at__year + , subq_1.paid_at__extract_year + , subq_1.paid_at__extract_quarter + , subq_1.paid_at__extract_month + , subq_1.paid_at__extract_week + , subq_1.paid_at__extract_day + , subq_1.paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear , subq_1.booking__ds__day , subq_1.booking__ds__week , subq_1.booking__ds__month , subq_1.booking__ds__quarter , subq_1.booking__ds__year + , subq_1.booking__ds__extract_year + , subq_1.booking__ds__extract_quarter + , subq_1.booking__ds__extract_month + , subq_1.booking__ds__extract_week + , subq_1.booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear , subq_1.booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month , subq_1.booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day , subq_1.booking__paid_at__week , subq_1.booking__paid_at__month , subq_1.booking__paid_at__quarter , subq_1.booking__paid_at__year + , subq_1.booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -82,31 +124,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -156,32 +240,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -217,21 +343,49 @@ CROSS JOIN ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.created_at__day , subq_7.created_at__week , subq_7.created_at__month , subq_7.created_at__quarter , subq_7.created_at__year + , subq_7.created_at__extract_year + , subq_7.created_at__extract_quarter + , subq_7.created_at__extract_month + , subq_7.created_at__extract_week + , subq_7.created_at__extract_day + , subq_7.created_at__extract_dayofweek + , subq_7.created_at__extract_dayofyear , subq_7.listing__ds__day , subq_7.listing__ds__week , subq_7.listing__ds__month , subq_7.listing__ds__quarter , subq_7.listing__ds__year + , subq_7.listing__ds__extract_year + , subq_7.listing__ds__extract_quarter + , subq_7.listing__ds__extract_month + , subq_7.listing__ds__extract_week + , subq_7.listing__ds__extract_day + , subq_7.listing__ds__extract_dayofweek + , subq_7.listing__ds__extract_dayofyear , subq_7.listing__created_at__day , subq_7.listing__created_at__week , subq_7.listing__created_at__month , subq_7.listing__created_at__quarter , subq_7.listing__created_at__year + , subq_7.listing__created_at__extract_year + , subq_7.listing__created_at__extract_quarter + , subq_7.listing__created_at__extract_month + , subq_7.listing__created_at__extract_week + , subq_7.listing__created_at__extract_day + , subq_7.listing__created_at__extract_dayofweek + , subq_7.listing__created_at__extract_dayofyear , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month @@ -257,21 +411,49 @@ CROSS JOIN ( , subq_6.ds__month , subq_6.ds__quarter , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_week + , subq_6.ds__extract_day + , subq_6.ds__extract_dayofweek + , subq_6.ds__extract_dayofyear , subq_6.created_at__day , subq_6.created_at__week , subq_6.created_at__month , subq_6.created_at__quarter , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_week + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dayofweek + , subq_6.created_at__extract_dayofyear , subq_6.listing__ds__day , subq_6.listing__ds__week , subq_6.listing__ds__month , subq_6.listing__ds__quarter , subq_6.listing__ds__year + , subq_6.listing__ds__extract_year + , subq_6.listing__ds__extract_quarter + , subq_6.listing__ds__extract_month + , subq_6.listing__ds__extract_week + , subq_6.listing__ds__extract_day + , subq_6.listing__ds__extract_dayofweek + , subq_6.listing__ds__extract_dayofyear , subq_6.listing__created_at__day , subq_6.listing__created_at__week , subq_6.listing__created_at__month , subq_6.listing__created_at__quarter , subq_6.listing__created_at__year + , subq_6.listing__created_at__extract_year + , subq_6.listing__created_at__extract_quarter + , subq_6.listing__created_at__extract_month + , subq_6.listing__created_at__extract_week + , subq_6.listing__created_at__extract_day + , subq_6.listing__created_at__extract_dayofweek + , subq_6.listing__created_at__extract_dayofyear , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month @@ -300,11 +482,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -313,11 +509,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql index 14a9f0385a..dc0afd0f09 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql @@ -44,31 +44,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -118,32 +160,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -182,31 +266,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -256,32 +382,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -332,31 +500,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -406,32 +616,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -480,31 +732,73 @@ FROM ( , subq_17.ds__month , subq_17.ds__quarter , subq_17.ds__year + , subq_17.ds__extract_year + , subq_17.ds__extract_quarter + , subq_17.ds__extract_month + , subq_17.ds__extract_week + , subq_17.ds__extract_day + , subq_17.ds__extract_dayofweek + , subq_17.ds__extract_dayofyear , subq_17.ds_partitioned__day , subq_17.ds_partitioned__week , subq_17.ds_partitioned__month , subq_17.ds_partitioned__quarter , subq_17.ds_partitioned__year + , subq_17.ds_partitioned__extract_year + , subq_17.ds_partitioned__extract_quarter + , subq_17.ds_partitioned__extract_month + , subq_17.ds_partitioned__extract_week + , subq_17.ds_partitioned__extract_day + , subq_17.ds_partitioned__extract_dayofweek + , subq_17.ds_partitioned__extract_dayofyear , subq_17.paid_at__day , subq_17.paid_at__week , subq_17.paid_at__month , subq_17.paid_at__quarter , subq_17.paid_at__year + , subq_17.paid_at__extract_year + , subq_17.paid_at__extract_quarter + , subq_17.paid_at__extract_month + , subq_17.paid_at__extract_week + , subq_17.paid_at__extract_day + , subq_17.paid_at__extract_dayofweek + , subq_17.paid_at__extract_dayofyear , subq_17.booking__ds__day , subq_17.booking__ds__week , subq_17.booking__ds__month , subq_17.booking__ds__quarter , subq_17.booking__ds__year + , subq_17.booking__ds__extract_year + , subq_17.booking__ds__extract_quarter + , subq_17.booking__ds__extract_month + , subq_17.booking__ds__extract_week + , subq_17.booking__ds__extract_day + , subq_17.booking__ds__extract_dayofweek + , subq_17.booking__ds__extract_dayofyear , subq_17.booking__ds_partitioned__day , subq_17.booking__ds_partitioned__week , subq_17.booking__ds_partitioned__month , subq_17.booking__ds_partitioned__quarter , subq_17.booking__ds_partitioned__year + , subq_17.booking__ds_partitioned__extract_year + , subq_17.booking__ds_partitioned__extract_quarter + , subq_17.booking__ds_partitioned__extract_month + , subq_17.booking__ds_partitioned__extract_week + , subq_17.booking__ds_partitioned__extract_day + , subq_17.booking__ds_partitioned__extract_dayofweek + , subq_17.booking__ds_partitioned__extract_dayofyear , subq_17.booking__paid_at__day , subq_17.booking__paid_at__week , subq_17.booking__paid_at__month , subq_17.booking__paid_at__quarter , subq_17.booking__paid_at__year + , subq_17.booking__paid_at__extract_year + , subq_17.booking__paid_at__extract_quarter + , subq_17.booking__paid_at__extract_month + , subq_17.booking__paid_at__extract_week + , subq_17.booking__paid_at__extract_day + , subq_17.booking__paid_at__extract_dayofweek + , subq_17.booking__paid_at__extract_dayofyear , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month @@ -554,32 +848,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql index be96decab5..63116a5458 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql @@ -45,32 +45,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql index a5288e7009..a53f3a075b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.verification__ds__day , subq_0.verification__ds__week , subq_0.verification__ds__month , subq_0.verification__ds__quarter , subq_0.verification__ds__year + , subq_0.verification__ds__extract_year + , subq_0.verification__ds__extract_quarter + , subq_0.verification__ds__extract_month + , subq_0.verification__ds__extract_week + , subq_0.verification__ds__extract_day + , subq_0.verification__ds__extract_dayofweek + , subq_0.verification__ds__extract_dayofyear , subq_0.verification__ds_partitioned__day , subq_0.verification__ds_partitioned__week , subq_0.verification__ds_partitioned__month , subq_0.verification__ds_partitioned__quarter , subq_0.verification__ds_partitioned__year + , subq_0.verification__ds_partitioned__extract_year + , subq_0.verification__ds_partitioned__extract_quarter + , subq_0.verification__ds_partitioned__extract_month + , subq_0.verification__ds_partitioned__extract_week + , subq_0.verification__ds_partitioned__extract_day + , subq_0.verification__ds_partitioned__extract_dayofweek + , subq_0.verification__ds_partitioned__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -71,22 +99,50 @@ FROM ( , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user @@ -110,32 +166,74 @@ FROM ( , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS ds__extract_dayofyear , users_ds_source_src_10007.created_at AS created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state , users_ds_source_src_10007.ds AS user__ds__day , DATE_TRUNC('week', users_ds_source_src_10007.ds) AS user__ds__week , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS user__ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS user__ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofyear , users_ds_source_src_10007.created_at AS user__created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS user__created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS user__created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS user__created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS user__created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state AS user__home_state , users_ds_source_src_10007.user_id AS user FROM ***************************.dim_users users_ds_source_src_10007 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql index c65a58a300..d88d2d32f3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -54,12 +82,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql index 603dac8609..094486f462 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql index adfa1c3f03..a8a26c9899 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 48a1b43de5..c400372dd4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 08a913aa57..30ab4c1851 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index ed796b148d..ef337f422c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql index 782ccc2826..16b897731d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -83,11 +125,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -96,11 +152,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql index 0f449eb59e..7dd5c3b39d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql index ee19129508..e240956212 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , is_instant AS booking__is_instant , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql index 214766cb17..073c7964da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_common_semantic_model__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -239,32 +365,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql index 63637a9433..c80b16baf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index f9ef4e1727..5f9a321abd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -51,31 +51,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -125,32 +167,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -175,21 +259,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -218,11 +330,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -231,11 +357,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -296,21 +436,49 @@ FROM ( , subq_10.ds__month , subq_10.ds__quarter , subq_10.ds__year + , subq_10.ds__extract_year + , subq_10.ds__extract_quarter + , subq_10.ds__extract_month + , subq_10.ds__extract_week + , subq_10.ds__extract_day + , subq_10.ds__extract_dayofweek + , subq_10.ds__extract_dayofyear , subq_10.ds_partitioned__day , subq_10.ds_partitioned__week , subq_10.ds_partitioned__month , subq_10.ds_partitioned__quarter , subq_10.ds_partitioned__year + , subq_10.ds_partitioned__extract_year + , subq_10.ds_partitioned__extract_quarter + , subq_10.ds_partitioned__extract_month + , subq_10.ds_partitioned__extract_week + , subq_10.ds_partitioned__extract_day + , subq_10.ds_partitioned__extract_dayofweek + , subq_10.ds_partitioned__extract_dayofyear , subq_10.view__ds__day , subq_10.view__ds__week , subq_10.view__ds__month , subq_10.view__ds__quarter , subq_10.view__ds__year + , subq_10.view__ds__extract_year + , subq_10.view__ds__extract_quarter + , subq_10.view__ds__extract_month + , subq_10.view__ds__extract_week + , subq_10.view__ds__extract_day + , subq_10.view__ds__extract_dayofweek + , subq_10.view__ds__extract_dayofyear , subq_10.view__ds_partitioned__day , subq_10.view__ds_partitioned__week , subq_10.view__ds_partitioned__month , subq_10.view__ds_partitioned__quarter , subq_10.view__ds_partitioned__year + , subq_10.view__ds_partitioned__extract_year + , subq_10.view__ds_partitioned__extract_quarter + , subq_10.view__ds_partitioned__extract_month + , subq_10.view__ds_partitioned__extract_week + , subq_10.view__ds_partitioned__extract_day + , subq_10.view__ds_partitioned__extract_dayofweek + , subq_10.view__ds_partitioned__extract_dayofyear , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month @@ -330,21 +498,49 @@ FROM ( , DATE_TRUNC('month', views_source_src_10009.ds) AS ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofyear , views_source_src_10009.ds AS view__ds__day , DATE_TRUNC('week', views_source_src_10009.ds) AS view__ds__week , DATE_TRUNC('month', views_source_src_10009.ds) AS view__ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS view__ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS view__ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS view__ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS view__ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS view__ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS view__ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS view__ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS view__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS view__ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS view__ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofyear , views_source_src_10009.listing_id AS listing , views_source_src_10009.user_id AS user , views_source_src_10009.listing_id AS view__listing @@ -367,21 +563,49 @@ FROM ( , subq_13.ds__month , subq_13.ds__quarter , subq_13.ds__year + , subq_13.ds__extract_year + , subq_13.ds__extract_quarter + , subq_13.ds__extract_month + , subq_13.ds__extract_week + , subq_13.ds__extract_day + , subq_13.ds__extract_dayofweek + , subq_13.ds__extract_dayofyear , subq_13.created_at__day , subq_13.created_at__week , subq_13.created_at__month , subq_13.created_at__quarter , subq_13.created_at__year + , subq_13.created_at__extract_year + , subq_13.created_at__extract_quarter + , subq_13.created_at__extract_month + , subq_13.created_at__extract_week + , subq_13.created_at__extract_day + , subq_13.created_at__extract_dayofweek + , subq_13.created_at__extract_dayofyear , subq_13.listing__ds__day , subq_13.listing__ds__week , subq_13.listing__ds__month , subq_13.listing__ds__quarter , subq_13.listing__ds__year + , subq_13.listing__ds__extract_year + , subq_13.listing__ds__extract_quarter + , subq_13.listing__ds__extract_month + , subq_13.listing__ds__extract_week + , subq_13.listing__ds__extract_day + , subq_13.listing__ds__extract_dayofweek + , subq_13.listing__ds__extract_dayofyear , subq_13.listing__created_at__day , subq_13.listing__created_at__week , subq_13.listing__created_at__month , subq_13.listing__created_at__quarter , subq_13.listing__created_at__year + , subq_13.listing__created_at__extract_year + , subq_13.listing__created_at__extract_quarter + , subq_13.listing__created_at__extract_month + , subq_13.listing__created_at__extract_week + , subq_13.listing__created_at__extract_day + , subq_13.listing__created_at__extract_dayofweek + , subq_13.listing__created_at__extract_dayofyear , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month @@ -410,11 +634,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -423,11 +661,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index e424fa31af..b2d5615477 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -47,32 +47,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -99,11 +141,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -112,11 +168,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql index 48583b238a..b6f01861d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql index 4ca35f2544..d480357663 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql @@ -38,32 +38,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql index b515ad2da5..f52c8d6acf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql index 5eb893b84a..4e79154b70 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql index 2393630095..f44071348d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql @@ -18,11 +18,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -40,11 +54,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql index 9ced88e0cc..4c321e73b0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index dd00d2b15e..4821d797fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql index 658dcf3357..2a39c9282f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql index 9bafb5e1f6..82ded0a878 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -170,31 +254,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -244,32 +370,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql index edbbe545fd..f21c6e33a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index c97b8fd930..34b929887f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql index 99b1685e16..dc71eeec86 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 7b95fddac1..de37ca714a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 954c695598..eb915512e3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -235,31 +361,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,31 +463,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -369,32 +579,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 40acec4cf6..bd5554a5b6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -236,31 +362,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,31 +464,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -370,32 +580,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql index b2b0889336..209f65b14c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_4.ds__month AS ds__month , subq_4.ds__quarter AS ds__quarter , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_week AS ds__extract_week + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_4.ds__extract_dayofyear AS ds__extract_dayofyear , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , subq_4.ds_partitioned__year AS ds_partitioned__year + , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_4.paid_at__day AS paid_at__day , subq_4.paid_at__week AS paid_at__week , subq_4.paid_at__month AS paid_at__month , subq_4.paid_at__quarter AS paid_at__quarter , subq_4.paid_at__year AS paid_at__year + , subq_4.paid_at__extract_year AS paid_at__extract_year + , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_4.paid_at__extract_month AS paid_at__extract_month + , subq_4.paid_at__extract_week AS paid_at__extract_week + , subq_4.paid_at__extract_day AS paid_at__extract_day + , subq_4.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_4.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_4.booking__ds__day AS booking__ds__day , subq_4.booking__ds__week AS booking__ds__week , subq_4.booking__ds__month AS booking__ds__month , subq_4.booking__ds__quarter AS booking__ds__quarter , subq_4.booking__ds__year AS booking__ds__year + , subq_4.booking__ds__extract_year AS booking__ds__extract_year + , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_4.booking__ds__extract_month AS booking__ds__extract_month + , subq_4.booking__ds__extract_week AS booking__ds__extract_week + , subq_4.booking__ds__extract_day AS booking__ds__extract_day + , subq_4.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_4.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_4.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_4.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_4.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_4.booking__paid_at__day AS booking__paid_at__day , subq_4.booking__paid_at__week AS booking__paid_at__week , subq_4.booking__paid_at__month AS booking__paid_at__month , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter , subq_4.booking__paid_at__year AS booking__paid_at__year + , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_4.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_4.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_4.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,31 +130,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , 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 @@ -152,31 +236,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -226,32 +352,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql index 73717860f9..6b3ac53490 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,31 +129,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -161,32 +245,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql index 870b2c80ea..3adff18e62 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_distinct_values__plan0.sql @@ -42,31 +42,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -116,32 +158,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -166,21 +250,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -209,11 +321,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -222,11 +348,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql index ddba65921c..00efad0383 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql @@ -25,32 +25,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql index 7ce1a71c7f..7e0fdff19e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql index 81e6d39ada..eb70f04221 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -48,31 +48,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -122,32 +164,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -172,21 +256,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -215,11 +327,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -228,11 +354,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql index 4caa3d07f0..b0f9388c61 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0.sql @@ -30,8 +30,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_4.window_start__day AS listing__window_start__day - , subq_4.window_end__day AS listing__window_end__day + , subq_4.window_start__extract_day AS listing__window_start__extract_day + , subq_4.window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_2.listing AS listing , subq_4.capacity AS listing__capacity , subq_2.bookings AS bookings @@ -50,31 +50,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -110,32 +152,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -152,8 +236,8 @@ FROM ( -- Pass Only Elements: -- ['capacity', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_3.window_start__day - , subq_3.window_end__day + subq_3.window_start__extract_day + , subq_3.window_end__extract_dayofyear , subq_3.listing , subq_3.capacity FROM ( @@ -164,11 +248,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +275,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -196,12 +308,12 @@ FROM ( subq_2.listing = subq_4.listing ) AND ( ( - subq_2.metric_time__day >= subq_4.window_start__day + subq_2.metric_time__day >= subq_4.window_start__extract_day ) AND ( ( - subq_2.metric_time__day < subq_4.window_end__day + subq_2.metric_time__day < subq_4.window_end__extract_dayofyear ) OR ( - subq_4.window_end__day IS NULL + subq_4.window_end__extract_dayofyear IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql index 86a2010b35..7fe03711cb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_scd_dimension__plan0_optimized.sql @@ -32,12 +32,12 @@ FROM ( subq_12.listing = listings_src_10017.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10017.active_from + subq_12.metric_time__day >= EXTRACT(DAY FROM listings_src_10017.active_from) ) AND ( ( - subq_12.metric_time__day < listings_src_10017.active_to + subq_12.metric_time__day < EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) ) OR ( - listings_src_10017.active_to IS NULL + EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 6ed1bd4e99..6ef8853985 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql index a26b98d66d..8e64ced98e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql index 027f20ea5b..16e8afe8d0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql index 913fed793c..b00d690648 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_limit_rows__plan0.sql @@ -26,31 +26,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql index 86b30c4553..583b4a4bf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_local_dimension_using_local_entity__plan0.sql @@ -21,21 +21,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.created_at__day , subq_0.created_at__week , subq_0.created_at__month , subq_0.created_at__quarter , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_week + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dayofweek + , subq_0.created_at__extract_dayofyear , subq_0.listing__ds__day , subq_0.listing__ds__week , subq_0.listing__ds__month , subq_0.listing__ds__quarter , subq_0.listing__ds__year + , subq_0.listing__ds__extract_year + , subq_0.listing__ds__extract_quarter + , subq_0.listing__ds__extract_month + , subq_0.listing__ds__extract_week + , subq_0.listing__ds__extract_day + , subq_0.listing__ds__extract_dayofweek + , subq_0.listing__ds__extract_dayofyear , subq_0.listing__created_at__day , subq_0.listing__created_at__week , subq_0.listing__created_at__month , subq_0.listing__created_at__quarter , subq_0.listing__created_at__year + , subq_0.listing__created_at__extract_year + , subq_0.listing__created_at__extract_quarter + , subq_0.listing__created_at__extract_month + , subq_0.listing__created_at__extract_week + , subq_0.listing__created_at__extract_day + , subq_0.listing__created_at__extract_dayofweek + , subq_0.listing__created_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -77,11 +119,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql index 316737d00a..b05da97264 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql @@ -35,32 +35,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql index 73e6a70d92..437dc887b4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint__plan0.sql @@ -60,31 +60,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -134,32 +176,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -184,21 +268,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -227,11 +339,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -240,11 +366,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -317,31 +457,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -391,32 +573,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -441,21 +665,49 @@ FROM ( , subq_15.ds__month , subq_15.ds__quarter , subq_15.ds__year + , subq_15.ds__extract_year + , subq_15.ds__extract_quarter + , subq_15.ds__extract_month + , subq_15.ds__extract_week + , subq_15.ds__extract_day + , subq_15.ds__extract_dayofweek + , subq_15.ds__extract_dayofyear , subq_15.created_at__day , subq_15.created_at__week , subq_15.created_at__month , subq_15.created_at__quarter , subq_15.created_at__year + , subq_15.created_at__extract_year + , subq_15.created_at__extract_quarter + , subq_15.created_at__extract_month + , subq_15.created_at__extract_week + , subq_15.created_at__extract_day + , subq_15.created_at__extract_dayofweek + , subq_15.created_at__extract_dayofyear , subq_15.listing__ds__day , subq_15.listing__ds__week , subq_15.listing__ds__month , subq_15.listing__ds__quarter , subq_15.listing__ds__year + , subq_15.listing__ds__extract_year + , subq_15.listing__ds__extract_quarter + , subq_15.listing__ds__extract_month + , subq_15.listing__ds__extract_week + , subq_15.listing__ds__extract_day + , subq_15.listing__ds__extract_dayofweek + , subq_15.listing__ds__extract_dayofyear , subq_15.listing__created_at__day , subq_15.listing__created_at__week , subq_15.listing__created_at__month , subq_15.listing__created_at__quarter , subq_15.listing__created_at__year + , subq_15.listing__created_at__extract_year + , subq_15.listing__created_at__extract_quarter + , subq_15.listing__created_at__extract_month + , subq_15.listing__created_at__extract_week + , subq_15.listing__created_at__extract_day + , subq_15.listing__created_at__extract_dayofweek + , subq_15.listing__created_at__extract_dayofyear , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month @@ -484,11 +736,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -497,11 +763,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -557,31 +837,73 @@ FROM ( , subq_24.ds__month , subq_24.ds__quarter , subq_24.ds__year + , subq_24.ds__extract_year + , subq_24.ds__extract_quarter + , subq_24.ds__extract_month + , subq_24.ds__extract_week + , subq_24.ds__extract_day + , subq_24.ds__extract_dayofweek + , subq_24.ds__extract_dayofyear , subq_24.ds_partitioned__day , subq_24.ds_partitioned__week , subq_24.ds_partitioned__month , subq_24.ds_partitioned__quarter , subq_24.ds_partitioned__year + , subq_24.ds_partitioned__extract_year + , subq_24.ds_partitioned__extract_quarter + , subq_24.ds_partitioned__extract_month + , subq_24.ds_partitioned__extract_week + , subq_24.ds_partitioned__extract_day + , subq_24.ds_partitioned__extract_dayofweek + , subq_24.ds_partitioned__extract_dayofyear , subq_24.paid_at__day , subq_24.paid_at__week , subq_24.paid_at__month , subq_24.paid_at__quarter , subq_24.paid_at__year + , subq_24.paid_at__extract_year + , subq_24.paid_at__extract_quarter + , subq_24.paid_at__extract_month + , subq_24.paid_at__extract_week + , subq_24.paid_at__extract_day + , subq_24.paid_at__extract_dayofweek + , subq_24.paid_at__extract_dayofyear , subq_24.booking__ds__day , subq_24.booking__ds__week , subq_24.booking__ds__month , subq_24.booking__ds__quarter , subq_24.booking__ds__year + , subq_24.booking__ds__extract_year + , subq_24.booking__ds__extract_quarter + , subq_24.booking__ds__extract_month + , subq_24.booking__ds__extract_week + , subq_24.booking__ds__extract_day + , subq_24.booking__ds__extract_dayofweek + , subq_24.booking__ds__extract_dayofyear , subq_24.booking__ds_partitioned__day , subq_24.booking__ds_partitioned__week , subq_24.booking__ds_partitioned__month , subq_24.booking__ds_partitioned__quarter , subq_24.booking__ds_partitioned__year + , subq_24.booking__ds_partitioned__extract_year + , subq_24.booking__ds_partitioned__extract_quarter + , subq_24.booking__ds_partitioned__extract_month + , subq_24.booking__ds_partitioned__extract_week + , subq_24.booking__ds_partitioned__extract_day + , subq_24.booking__ds_partitioned__extract_dayofweek + , subq_24.booking__ds_partitioned__extract_dayofyear , subq_24.booking__paid_at__day , subq_24.booking__paid_at__week , subq_24.booking__paid_at__month , subq_24.booking__paid_at__quarter , subq_24.booking__paid_at__year + , subq_24.booking__paid_at__extract_year + , subq_24.booking__paid_at__extract_quarter + , subq_24.booking__paid_at__extract_month + , subq_24.booking__paid_at__extract_week + , subq_24.booking__paid_at__extract_day + , subq_24.booking__paid_at__extract_dayofweek + , subq_24.booking__paid_at__extract_dayofyear , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month @@ -631,32 +953,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql index f951333a58..9626242169 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0.sql @@ -45,31 +45,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -119,32 +161,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -186,31 +270,73 @@ FROM ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.ds_partitioned__day , subq_7.ds_partitioned__week , subq_7.ds_partitioned__month , subq_7.ds_partitioned__quarter , subq_7.ds_partitioned__year + , subq_7.ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_week + , subq_7.ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dayofweek + , subq_7.ds_partitioned__extract_dayofyear , subq_7.paid_at__day , subq_7.paid_at__week , subq_7.paid_at__month , subq_7.paid_at__quarter , subq_7.paid_at__year + , subq_7.paid_at__extract_year + , subq_7.paid_at__extract_quarter + , subq_7.paid_at__extract_month + , subq_7.paid_at__extract_week + , subq_7.paid_at__extract_day + , subq_7.paid_at__extract_dayofweek + , subq_7.paid_at__extract_dayofyear , subq_7.booking__ds__day , subq_7.booking__ds__week , subq_7.booking__ds__month , subq_7.booking__ds__quarter , subq_7.booking__ds__year + , subq_7.booking__ds__extract_year + , subq_7.booking__ds__extract_quarter + , subq_7.booking__ds__extract_month + , subq_7.booking__ds__extract_week + , subq_7.booking__ds__extract_day + , subq_7.booking__ds__extract_dayofweek + , subq_7.booking__ds__extract_dayofyear , subq_7.booking__ds_partitioned__day , subq_7.booking__ds_partitioned__week , subq_7.booking__ds_partitioned__month , subq_7.booking__ds_partitioned__quarter , subq_7.booking__ds_partitioned__year + , subq_7.booking__ds_partitioned__extract_year + , subq_7.booking__ds_partitioned__extract_quarter + , subq_7.booking__ds_partitioned__extract_month + , subq_7.booking__ds_partitioned__extract_week + , subq_7.booking__ds_partitioned__extract_day + , subq_7.booking__ds_partitioned__extract_dayofweek + , subq_7.booking__ds_partitioned__extract_dayofyear , subq_7.booking__paid_at__day , subq_7.booking__paid_at__week , subq_7.booking__paid_at__month , subq_7.booking__paid_at__quarter , subq_7.booking__paid_at__year + , subq_7.booking__paid_at__extract_year + , subq_7.booking__paid_at__extract_quarter + , subq_7.booking__paid_at__extract_month + , subq_7.booking__paid_at__extract_week + , subq_7.booking__paid_at__extract_day + , subq_7.booking__paid_at__extract_dayofweek + , subq_7.booking__paid_at__extract_dayofyear , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month @@ -260,32 +386,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 13d80a91d0..a495423238 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -39,31 +39,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -113,32 +155,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index e05efe9cf1..c868e3cfd9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -160,21 +244,49 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.created_at__day , subq_5.created_at__week , subq_5.created_at__month , subq_5.created_at__quarter , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_week + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dayofweek + , subq_5.created_at__extract_dayofyear , subq_5.listing__ds__day , subq_5.listing__ds__week , subq_5.listing__ds__month , subq_5.listing__ds__quarter , subq_5.listing__ds__year + , subq_5.listing__ds__extract_year + , subq_5.listing__ds__extract_quarter + , subq_5.listing__ds__extract_month + , subq_5.listing__ds__extract_week + , subq_5.listing__ds__extract_day + , subq_5.listing__ds__extract_dayofweek + , subq_5.listing__ds__extract_dayofyear , subq_5.listing__created_at__day , subq_5.listing__created_at__week , subq_5.listing__created_at__month , subq_5.listing__created_at__quarter , subq_5.listing__created_at__year + , subq_5.listing__created_at__extract_year + , subq_5.listing__created_at__extract_quarter + , subq_5.listing__created_at__extract_month + , subq_5.listing__created_at__extract_week + , subq_5.listing__created_at__extract_day + , subq_5.listing__created_at__extract_dayofweek + , subq_5.listing__created_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -203,11 +315,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -216,11 +342,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql index 88cc0b431d..3dd22ada6b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.window_start__day AS listing__window_start__day - , subq_7.window_end__day AS listing__window_end__day + , subq_7.window_start__extract_day AS listing__window_start__extract_day + , subq_7.window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_2.listing AS listing , subq_7.user__home_state_latest AS listing__user__home_state_latest , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -142,8 +226,8 @@ FROM ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_6.window_start__day - , subq_6.window_end__day + subq_6.window_start__extract_day + , subq_6.window_end__extract_dayofyear , subq_6.listing , subq_6.user__home_state_latest FROM ( @@ -154,26 +238,61 @@ FROM ( , subq_3.window_start__month AS window_start__month , subq_3.window_start__quarter AS window_start__quarter , subq_3.window_start__year AS window_start__year + , subq_3.window_start__extract_year AS window_start__extract_year + , subq_3.window_start__extract_quarter AS window_start__extract_quarter + , subq_3.window_start__extract_month AS window_start__extract_month + , subq_3.window_start__extract_week AS window_start__extract_week + , subq_3.window_start__extract_day AS window_start__extract_day + , subq_3.window_start__extract_dayofweek AS window_start__extract_dayofweek + , subq_3.window_start__extract_dayofyear AS window_start__extract_dayofyear , subq_3.window_end__day AS window_end__day , subq_3.window_end__week AS window_end__week , subq_3.window_end__month AS window_end__month , subq_3.window_end__quarter AS window_end__quarter , subq_3.window_end__year AS window_end__year + , subq_3.window_end__extract_year AS window_end__extract_year + , subq_3.window_end__extract_quarter AS window_end__extract_quarter + , subq_3.window_end__extract_month AS window_end__extract_month + , subq_3.window_end__extract_week AS window_end__extract_week + , subq_3.window_end__extract_day AS window_end__extract_day + , subq_3.window_end__extract_dayofweek AS window_end__extract_dayofweek + , subq_3.window_end__extract_dayofyear AS window_end__extract_dayofyear , subq_3.listing__window_start__day AS listing__window_start__day , subq_3.listing__window_start__week AS listing__window_start__week , subq_3.listing__window_start__month AS listing__window_start__month , subq_3.listing__window_start__quarter AS listing__window_start__quarter , subq_3.listing__window_start__year AS listing__window_start__year + , subq_3.listing__window_start__extract_year AS listing__window_start__extract_year + , subq_3.listing__window_start__extract_quarter AS listing__window_start__extract_quarter + , subq_3.listing__window_start__extract_month AS listing__window_start__extract_month + , subq_3.listing__window_start__extract_week AS listing__window_start__extract_week + , subq_3.listing__window_start__extract_day AS listing__window_start__extract_day + , subq_3.listing__window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_3.listing__window_start__extract_dayofyear AS listing__window_start__extract_dayofyear , subq_3.listing__window_end__day AS listing__window_end__day , subq_3.listing__window_end__week AS listing__window_end__week , subq_3.listing__window_end__month AS listing__window_end__month , subq_3.listing__window_end__quarter AS listing__window_end__quarter , subq_3.listing__window_end__year AS listing__window_end__year + , subq_3.listing__window_end__extract_year AS listing__window_end__extract_year + , subq_3.listing__window_end__extract_quarter AS listing__window_end__extract_quarter + , subq_3.listing__window_end__extract_month AS listing__window_end__extract_month + , subq_3.listing__window_end__extract_week AS listing__window_end__extract_week + , subq_3.listing__window_end__extract_day AS listing__window_end__extract_day + , subq_3.listing__window_end__extract_dayofweek AS listing__window_end__extract_dayofweek + , subq_3.listing__window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dayofweek AS user__ds__extract_dayofweek + , subq_5.ds__extract_dayofyear AS user__ds__extract_dayofyear , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +311,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +338,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -227,11 +374,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +400,25 @@ FROM ( , subq_4.ds__month , subq_4.ds__quarter , subq_4.ds__year + , subq_4.ds__extract_year + , subq_4.ds__extract_quarter + , subq_4.ds__extract_month + , subq_4.ds__extract_week + , subq_4.ds__extract_day + , subq_4.ds__extract_dayofweek + , subq_4.ds__extract_dayofyear , subq_4.user__ds__day , subq_4.user__ds__week , subq_4.user__ds__month , subq_4.user__ds__quarter , subq_4.user__ds__year + , subq_4.user__ds__extract_year + , subq_4.user__ds__extract_quarter + , subq_4.user__ds__extract_month + , subq_4.user__ds__extract_week + , subq_4.user__ds__extract_day + , subq_4.user__ds__extract_dayofweek + , subq_4.user__ds__extract_dayofyear , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +430,26 @@ FROM ( , DATE_TRUNC('month', users_latest_src_10021.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS ds__extract_dayofyear , users_latest_src_10021.home_state_latest , users_latest_src_10021.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10021.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10021.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS user__ds__extract_dayofyear , users_latest_src_10021.home_state_latest AS user__home_state_latest , users_latest_src_10021.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10021 @@ -275,12 +464,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.window_start__day + subq_2.metric_time__day >= subq_7.window_start__extract_day ) AND ( ( - subq_2.metric_time__day < subq_7.window_end__day + subq_2.metric_time__day < subq_7.window_end__extract_dayofyear ) OR ( - subq_7.window_end__day IS NULL + subq_7.window_end__extract_dayofyear IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql index feb5ed0fdc..aac4f6d3da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -23,8 +23,8 @@ LEFT OUTER JOIN ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10017.active_from AS window_start__day - , listings_src_10017.active_to AS window_end__day + EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.listing_id AS listing , users_latest_src_10021.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings listings_src_10017 @@ -38,12 +38,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.window_start__day + subq_13.metric_time__day >= subq_18.window_start__extract_day ) AND ( ( - subq_13.metric_time__day < subq_18.window_end__day + subq_13.metric_time__day < subq_18.window_end__extract_dayofyear ) OR ( - subq_18.window_end__day IS NULL + subq_18.window_end__extract_dayofyear IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql index 94054a124c..529bf04290 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.lux_listing__window_start__day AS listing__lux_listing__window_start__day - , subq_7.lux_listing__window_end__day AS listing__lux_listing__window_end__day + , subq_7.lux_listing__window_start__extract_quarter AS listing__lux_listing__window_start__extract_quarter + , subq_7.lux_listing__window_end__extract_quarter AS listing__lux_listing__window_end__extract_quarter , subq_2.listing AS listing , subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -145,8 +229,8 @@ FROM ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - subq_6.lux_listing__window_start__day - , subq_6.lux_listing__window_end__day + subq_6.lux_listing__window_start__extract_quarter + , subq_6.lux_listing__window_end__extract_quarter , subq_6.listing , subq_6.lux_listing__is_confirmed_lux FROM ( @@ -157,11 +241,25 @@ FROM ( , subq_5.window_start__month AS lux_listing__window_start__month , subq_5.window_start__quarter AS lux_listing__window_start__quarter , subq_5.window_start__year AS lux_listing__window_start__year + , subq_5.window_start__extract_year AS lux_listing__window_start__extract_year + , subq_5.window_start__extract_quarter AS lux_listing__window_start__extract_quarter + , subq_5.window_start__extract_month AS lux_listing__window_start__extract_month + , subq_5.window_start__extract_week AS lux_listing__window_start__extract_week + , subq_5.window_start__extract_day AS lux_listing__window_start__extract_day + , subq_5.window_start__extract_dayofweek AS lux_listing__window_start__extract_dayofweek + , subq_5.window_start__extract_dayofyear AS lux_listing__window_start__extract_dayofyear , subq_5.window_end__day AS lux_listing__window_end__day , subq_5.window_end__week AS lux_listing__window_end__week , subq_5.window_end__month AS lux_listing__window_end__month , subq_5.window_end__quarter AS lux_listing__window_end__quarter , subq_5.window_end__year AS lux_listing__window_end__year + , subq_5.window_end__extract_year AS lux_listing__window_end__extract_year + , subq_5.window_end__extract_quarter AS lux_listing__window_end__extract_quarter + , subq_5.window_end__extract_month AS lux_listing__window_end__extract_month + , subq_5.window_end__extract_week AS lux_listing__window_end__extract_week + , subq_5.window_end__extract_day AS lux_listing__window_end__extract_day + , subq_5.window_end__extract_dayofweek AS lux_listing__window_end__extract_dayofweek + , subq_5.window_end__extract_dayofyear AS lux_listing__window_end__extract_dayofyear , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +281,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +331,49 @@ FROM ( , subq_4.window_start__month , subq_4.window_start__quarter , subq_4.window_start__year + , subq_4.window_start__extract_year + , subq_4.window_start__extract_quarter + , subq_4.window_start__extract_month + , subq_4.window_start__extract_week + , subq_4.window_start__extract_day + , subq_4.window_start__extract_dayofweek + , subq_4.window_start__extract_dayofyear , subq_4.window_end__day , subq_4.window_end__week , subq_4.window_end__month , subq_4.window_end__quarter , subq_4.window_end__year + , subq_4.window_end__extract_year + , subq_4.window_end__extract_quarter + , subq_4.window_end__extract_month + , subq_4.window_end__extract_week + , subq_4.window_end__extract_day + , subq_4.window_end__extract_dayofweek + , subq_4.window_end__extract_dayofyear , subq_4.lux_listing__window_start__day , subq_4.lux_listing__window_start__week , subq_4.lux_listing__window_start__month , subq_4.lux_listing__window_start__quarter , subq_4.lux_listing__window_start__year + , subq_4.lux_listing__window_start__extract_year + , subq_4.lux_listing__window_start__extract_quarter + , subq_4.lux_listing__window_start__extract_month + , subq_4.lux_listing__window_start__extract_week + , subq_4.lux_listing__window_start__extract_day + , subq_4.lux_listing__window_start__extract_dayofweek + , subq_4.lux_listing__window_start__extract_dayofyear , subq_4.lux_listing__window_end__day , subq_4.lux_listing__window_end__week , subq_4.lux_listing__window_end__month , subq_4.lux_listing__window_end__quarter , subq_4.lux_listing__window_end__year + , subq_4.lux_listing__window_end__extract_year + , subq_4.lux_listing__window_end__extract_quarter + , subq_4.lux_listing__window_end__extract_month + , subq_4.lux_listing__window_end__extract_week + , subq_4.lux_listing__window_end__extract_day + , subq_4.lux_listing__window_end__extract_dayofweek + , subq_4.lux_listing__window_end__extract_dayofyear , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +385,50 @@ FROM ( , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux , lux_listings_src_10019.valid_from AS lux_listing__window_start__day , DATE_TRUNC('week', lux_listings_src_10019.valid_from) AS lux_listing__window_start__week , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS lux_listing__window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS lux_listing__window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS lux_listing__window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS lux_listing__window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS lux_listing__window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS lux_listing__window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS lux_listing__window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS lux_listing__window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux , lux_listings_src_10019.lux_listing_id AS lux_listing FROM ***************************.dim_lux_listings lux_listings_src_10019 @@ -261,12 +443,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.lux_listing__window_start__day + subq_2.metric_time__day >= subq_7.lux_listing__window_start__extract_quarter ) AND ( ( - subq_2.metric_time__day < subq_7.lux_listing__window_end__day + subq_2.metric_time__day < subq_7.lux_listing__window_end__extract_quarter ) OR ( - subq_7.lux_listing__window_end__day IS NULL + subq_7.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql index f1b419a284..ed02e59c3d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -26,8 +26,8 @@ LEFT OUTER JOIN ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - lux_listings_src_10019.valid_from AS lux_listing__window_start__day - , lux_listings_src_10019.valid_to AS lux_listing__window_end__day + EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter , lux_listing_mapping_src_10018.listing_id AS listing , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10018 @@ -41,12 +41,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.lux_listing__window_start__day + subq_13.metric_time__day >= subq_18.lux_listing__window_start__extract_quarter ) AND ( ( - subq_13.metric_time__day < subq_18.lux_listing__window_end__day + subq_13.metric_time__day < subq_18.lux_listing__window_end__extract_quarter ) OR ( - subq_18.lux_listing__window_end__day IS NULL + subq_18.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql index ae8b7838b7..cb9670f074 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql @@ -33,32 +33,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -85,11 +127,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -98,11 +154,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -131,11 +201,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -144,11 +228,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql index d35179ebf0..fbddd59f54 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.ds__day , subq_0.ds__week , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.account_id__ds_partitioned__day , subq_0.account_id__ds_partitioned__week , subq_0.account_id__ds_partitioned__month , subq_0.account_id__ds_partitioned__quarter , subq_0.account_id__ds_partitioned__year + , subq_0.account_id__ds_partitioned__extract_year + , subq_0.account_id__ds_partitioned__extract_quarter + , subq_0.account_id__ds_partitioned__extract_month + , subq_0.account_id__ds_partitioned__extract_week + , subq_0.account_id__ds_partitioned__extract_day + , subq_0.account_id__ds_partitioned__extract_dayofweek + , subq_0.account_id__ds_partitioned__extract_dayofyear , subq_0.account_id__ds__day , subq_0.account_id__ds__week , subq_0.account_id__ds__month , subq_0.account_id__ds__quarter , subq_0.account_id__ds__year + , subq_0.account_id__ds__extract_year + , subq_0.account_id__ds__extract_quarter + , subq_0.account_id__ds__extract_month + , subq_0.account_id__ds__extract_week + , subq_0.account_id__ds__extract_day + , subq_0.account_id__ds__extract_dayofweek + , subq_0.account_id__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -69,22 +97,50 @@ FROM ( , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS ds__extract_dayofyear , account_month_txns_src_10010.account_month , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS account_id__ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS account_id__ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS account_id__ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS account_id__ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS account_id__ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofyear , account_month_txns_src_10010.account_month AS account_id__account_month , account_month_txns_src_10010.account_id FROM ***************************.account_month_txns account_month_txns_src_10010 @@ -106,16 +162,37 @@ FROM ( , subq_3.ds_partitioned__month AS ds_partitioned__month , subq_3.ds_partitioned__quarter AS ds_partitioned__quarter , subq_3.ds_partitioned__year AS ds_partitioned__year + , subq_3.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_3.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_3.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_3.account_id__ds_partitioned__day AS account_id__ds_partitioned__day , subq_3.account_id__ds_partitioned__week AS account_id__ds_partitioned__week , subq_3.account_id__ds_partitioned__month AS account_id__ds_partitioned__month , subq_3.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter , subq_3.account_id__ds_partitioned__year AS account_id__ds_partitioned__year + , subq_3.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year + , subq_3.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter + , subq_3.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month + , subq_3.account_id__ds_partitioned__extract_week AS account_id__ds_partitioned__extract_week + , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day + , subq_3.account_id__ds_partitioned__extract_dayofweek AS account_id__ds_partitioned__extract_dayofweek + , subq_3.account_id__ds_partitioned__extract_dayofyear AS account_id__ds_partitioned__extract_dayofyear , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month , subq_5.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter , subq_5.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_5.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week AS customer_id__ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek AS customer_id__ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear AS customer_id__ds_partitioned__extract_dayofyear , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id @@ -132,12 +209,26 @@ FROM ( , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofyear , bridge_table_src_10011.extra_dim AS account_id__extra_dim , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id @@ -154,11 +245,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +271,25 @@ FROM ( , subq_4.ds_partitioned__month , subq_4.ds_partitioned__quarter , subq_4.ds_partitioned__year + , subq_4.ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear , subq_4.customer_id__ds_partitioned__day , subq_4.customer_id__ds_partitioned__week , subq_4.customer_id__ds_partitioned__month , subq_4.customer_id__ds_partitioned__quarter , subq_4.customer_id__ds_partitioned__year + , subq_4.customer_id__ds_partitioned__extract_year + , subq_4.customer_id__ds_partitioned__extract_quarter + , subq_4.customer_id__ds_partitioned__extract_month + , subq_4.customer_id__ds_partitioned__extract_week + , subq_4.customer_id__ds_partitioned__extract_day + , subq_4.customer_id__ds_partitioned__extract_dayofweek + , subq_4.customer_id__ds_partitioned__extract_dayofyear , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +305,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_name AS customer_id__customer_name , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned__day @@ -193,6 +319,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_id FROM ***************************.customer_table customer_table_src_10013 ) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql index 5c9089deaf..eb31a4fb3a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multiple_metrics_no_dimensions__plan0.sql @@ -23,31 +23,73 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.ds_partitioned__day , subq_1.ds_partitioned__week , subq_1.ds_partitioned__month , subq_1.ds_partitioned__quarter , subq_1.ds_partitioned__year + , subq_1.ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear , subq_1.paid_at__day , subq_1.paid_at__week , subq_1.paid_at__month , subq_1.paid_at__quarter , subq_1.paid_at__year + , subq_1.paid_at__extract_year + , subq_1.paid_at__extract_quarter + , subq_1.paid_at__extract_month + , subq_1.paid_at__extract_week + , subq_1.paid_at__extract_day + , subq_1.paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear , subq_1.booking__ds__day , subq_1.booking__ds__week , subq_1.booking__ds__month , subq_1.booking__ds__quarter , subq_1.booking__ds__year + , subq_1.booking__ds__extract_year + , subq_1.booking__ds__extract_quarter + , subq_1.booking__ds__extract_month + , subq_1.booking__ds__extract_week + , subq_1.booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear , subq_1.booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month , subq_1.booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day , subq_1.booking__paid_at__week , subq_1.booking__paid_at__month , subq_1.booking__paid_at__quarter , subq_1.booking__paid_at__year + , subq_1.booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -82,31 +124,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -156,32 +240,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -217,21 +343,49 @@ CROSS JOIN ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.created_at__day , subq_7.created_at__week , subq_7.created_at__month , subq_7.created_at__quarter , subq_7.created_at__year + , subq_7.created_at__extract_year + , subq_7.created_at__extract_quarter + , subq_7.created_at__extract_month + , subq_7.created_at__extract_week + , subq_7.created_at__extract_day + , subq_7.created_at__extract_dayofweek + , subq_7.created_at__extract_dayofyear , subq_7.listing__ds__day , subq_7.listing__ds__week , subq_7.listing__ds__month , subq_7.listing__ds__quarter , subq_7.listing__ds__year + , subq_7.listing__ds__extract_year + , subq_7.listing__ds__extract_quarter + , subq_7.listing__ds__extract_month + , subq_7.listing__ds__extract_week + , subq_7.listing__ds__extract_day + , subq_7.listing__ds__extract_dayofweek + , subq_7.listing__ds__extract_dayofyear , subq_7.listing__created_at__day , subq_7.listing__created_at__week , subq_7.listing__created_at__month , subq_7.listing__created_at__quarter , subq_7.listing__created_at__year + , subq_7.listing__created_at__extract_year + , subq_7.listing__created_at__extract_quarter + , subq_7.listing__created_at__extract_month + , subq_7.listing__created_at__extract_week + , subq_7.listing__created_at__extract_day + , subq_7.listing__created_at__extract_dayofweek + , subq_7.listing__created_at__extract_dayofyear , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month @@ -257,21 +411,49 @@ CROSS JOIN ( , subq_6.ds__month , subq_6.ds__quarter , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_week + , subq_6.ds__extract_day + , subq_6.ds__extract_dayofweek + , subq_6.ds__extract_dayofyear , subq_6.created_at__day , subq_6.created_at__week , subq_6.created_at__month , subq_6.created_at__quarter , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_week + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dayofweek + , subq_6.created_at__extract_dayofyear , subq_6.listing__ds__day , subq_6.listing__ds__week , subq_6.listing__ds__month , subq_6.listing__ds__quarter , subq_6.listing__ds__year + , subq_6.listing__ds__extract_year + , subq_6.listing__ds__extract_quarter + , subq_6.listing__ds__extract_month + , subq_6.listing__ds__extract_week + , subq_6.listing__ds__extract_day + , subq_6.listing__ds__extract_dayofweek + , subq_6.listing__ds__extract_dayofyear , subq_6.listing__created_at__day , subq_6.listing__created_at__week , subq_6.listing__created_at__month , subq_6.listing__created_at__quarter , subq_6.listing__created_at__year + , subq_6.listing__created_at__extract_year + , subq_6.listing__created_at__extract_quarter + , subq_6.listing__created_at__extract_month + , subq_6.listing__created_at__extract_week + , subq_6.listing__created_at__extract_day + , subq_6.listing__created_at__extract_dayofweek + , subq_6.listing__created_at__extract_dayofyear , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month @@ -300,11 +482,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -313,11 +509,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql index 14a9f0385a..dc0afd0f09 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql @@ -44,31 +44,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -118,32 +160,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -182,31 +266,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -256,32 +382,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -332,31 +500,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -406,32 +616,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -480,31 +732,73 @@ FROM ( , subq_17.ds__month , subq_17.ds__quarter , subq_17.ds__year + , subq_17.ds__extract_year + , subq_17.ds__extract_quarter + , subq_17.ds__extract_month + , subq_17.ds__extract_week + , subq_17.ds__extract_day + , subq_17.ds__extract_dayofweek + , subq_17.ds__extract_dayofyear , subq_17.ds_partitioned__day , subq_17.ds_partitioned__week , subq_17.ds_partitioned__month , subq_17.ds_partitioned__quarter , subq_17.ds_partitioned__year + , subq_17.ds_partitioned__extract_year + , subq_17.ds_partitioned__extract_quarter + , subq_17.ds_partitioned__extract_month + , subq_17.ds_partitioned__extract_week + , subq_17.ds_partitioned__extract_day + , subq_17.ds_partitioned__extract_dayofweek + , subq_17.ds_partitioned__extract_dayofyear , subq_17.paid_at__day , subq_17.paid_at__week , subq_17.paid_at__month , subq_17.paid_at__quarter , subq_17.paid_at__year + , subq_17.paid_at__extract_year + , subq_17.paid_at__extract_quarter + , subq_17.paid_at__extract_month + , subq_17.paid_at__extract_week + , subq_17.paid_at__extract_day + , subq_17.paid_at__extract_dayofweek + , subq_17.paid_at__extract_dayofyear , subq_17.booking__ds__day , subq_17.booking__ds__week , subq_17.booking__ds__month , subq_17.booking__ds__quarter , subq_17.booking__ds__year + , subq_17.booking__ds__extract_year + , subq_17.booking__ds__extract_quarter + , subq_17.booking__ds__extract_month + , subq_17.booking__ds__extract_week + , subq_17.booking__ds__extract_day + , subq_17.booking__ds__extract_dayofweek + , subq_17.booking__ds__extract_dayofyear , subq_17.booking__ds_partitioned__day , subq_17.booking__ds_partitioned__week , subq_17.booking__ds_partitioned__month , subq_17.booking__ds_partitioned__quarter , subq_17.booking__ds_partitioned__year + , subq_17.booking__ds_partitioned__extract_year + , subq_17.booking__ds_partitioned__extract_quarter + , subq_17.booking__ds_partitioned__extract_month + , subq_17.booking__ds_partitioned__extract_week + , subq_17.booking__ds_partitioned__extract_day + , subq_17.booking__ds_partitioned__extract_dayofweek + , subq_17.booking__ds_partitioned__extract_dayofyear , subq_17.booking__paid_at__day , subq_17.booking__paid_at__week , subq_17.booking__paid_at__month , subq_17.booking__paid_at__quarter , subq_17.booking__paid_at__year + , subq_17.booking__paid_at__extract_year + , subq_17.booking__paid_at__extract_quarter + , subq_17.booking__paid_at__extract_month + , subq_17.booking__paid_at__extract_week + , subq_17.booking__paid_at__extract_day + , subq_17.booking__paid_at__extract_dayofweek + , subq_17.booking__paid_at__extract_dayofyear , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month @@ -554,32 +848,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql index be96decab5..63116a5458 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql @@ -45,32 +45,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql index a5288e7009..a53f3a075b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.verification__ds__day , subq_0.verification__ds__week , subq_0.verification__ds__month , subq_0.verification__ds__quarter , subq_0.verification__ds__year + , subq_0.verification__ds__extract_year + , subq_0.verification__ds__extract_quarter + , subq_0.verification__ds__extract_month + , subq_0.verification__ds__extract_week + , subq_0.verification__ds__extract_day + , subq_0.verification__ds__extract_dayofweek + , subq_0.verification__ds__extract_dayofyear , subq_0.verification__ds_partitioned__day , subq_0.verification__ds_partitioned__week , subq_0.verification__ds_partitioned__month , subq_0.verification__ds_partitioned__quarter , subq_0.verification__ds_partitioned__year + , subq_0.verification__ds_partitioned__extract_year + , subq_0.verification__ds_partitioned__extract_quarter + , subq_0.verification__ds_partitioned__extract_month + , subq_0.verification__ds_partitioned__extract_week + , subq_0.verification__ds_partitioned__extract_day + , subq_0.verification__ds_partitioned__extract_dayofweek + , subq_0.verification__ds_partitioned__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -71,22 +99,50 @@ FROM ( , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user @@ -110,32 +166,74 @@ FROM ( , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS ds__extract_dayofyear , users_ds_source_src_10007.created_at AS created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state , users_ds_source_src_10007.ds AS user__ds__day , DATE_TRUNC('week', users_ds_source_src_10007.ds) AS user__ds__week , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS user__ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS user__ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofyear , users_ds_source_src_10007.created_at AS user__created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS user__created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS user__created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS user__created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS user__created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state AS user__home_state , users_ds_source_src_10007.user_id AS user FROM ***************************.dim_users users_ds_source_src_10007 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql index c65a58a300..d88d2d32f3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -54,12 +82,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql index 603dac8609..094486f462 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql index adfa1c3f03..a8a26c9899 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 48a1b43de5..c400372dd4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 08a913aa57..30ab4c1851 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index ed796b148d..ef337f422c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql index 782ccc2826..16b897731d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -83,11 +125,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -96,11 +152,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql index 0f449eb59e..7dd5c3b39d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql index ee19129508..e240956212 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , is_instant AS booking__is_instant , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql index 214766cb17..073c7964da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_common_semantic_model__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -239,32 +365,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql index 63637a9433..c80b16baf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index f9ef4e1727..5f9a321abd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -51,31 +51,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -125,32 +167,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -175,21 +259,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -218,11 +330,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -231,11 +357,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -296,21 +436,49 @@ FROM ( , subq_10.ds__month , subq_10.ds__quarter , subq_10.ds__year + , subq_10.ds__extract_year + , subq_10.ds__extract_quarter + , subq_10.ds__extract_month + , subq_10.ds__extract_week + , subq_10.ds__extract_day + , subq_10.ds__extract_dayofweek + , subq_10.ds__extract_dayofyear , subq_10.ds_partitioned__day , subq_10.ds_partitioned__week , subq_10.ds_partitioned__month , subq_10.ds_partitioned__quarter , subq_10.ds_partitioned__year + , subq_10.ds_partitioned__extract_year + , subq_10.ds_partitioned__extract_quarter + , subq_10.ds_partitioned__extract_month + , subq_10.ds_partitioned__extract_week + , subq_10.ds_partitioned__extract_day + , subq_10.ds_partitioned__extract_dayofweek + , subq_10.ds_partitioned__extract_dayofyear , subq_10.view__ds__day , subq_10.view__ds__week , subq_10.view__ds__month , subq_10.view__ds__quarter , subq_10.view__ds__year + , subq_10.view__ds__extract_year + , subq_10.view__ds__extract_quarter + , subq_10.view__ds__extract_month + , subq_10.view__ds__extract_week + , subq_10.view__ds__extract_day + , subq_10.view__ds__extract_dayofweek + , subq_10.view__ds__extract_dayofyear , subq_10.view__ds_partitioned__day , subq_10.view__ds_partitioned__week , subq_10.view__ds_partitioned__month , subq_10.view__ds_partitioned__quarter , subq_10.view__ds_partitioned__year + , subq_10.view__ds_partitioned__extract_year + , subq_10.view__ds_partitioned__extract_quarter + , subq_10.view__ds_partitioned__extract_month + , subq_10.view__ds_partitioned__extract_week + , subq_10.view__ds_partitioned__extract_day + , subq_10.view__ds_partitioned__extract_dayofweek + , subq_10.view__ds_partitioned__extract_dayofyear , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month @@ -330,21 +498,49 @@ FROM ( , DATE_TRUNC('month', views_source_src_10009.ds) AS ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofyear , views_source_src_10009.ds AS view__ds__day , DATE_TRUNC('week', views_source_src_10009.ds) AS view__ds__week , DATE_TRUNC('month', views_source_src_10009.ds) AS view__ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS view__ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS view__ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS view__ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS view__ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS view__ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS view__ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS view__ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS view__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS view__ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS view__ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofyear , views_source_src_10009.listing_id AS listing , views_source_src_10009.user_id AS user , views_source_src_10009.listing_id AS view__listing @@ -367,21 +563,49 @@ FROM ( , subq_13.ds__month , subq_13.ds__quarter , subq_13.ds__year + , subq_13.ds__extract_year + , subq_13.ds__extract_quarter + , subq_13.ds__extract_month + , subq_13.ds__extract_week + , subq_13.ds__extract_day + , subq_13.ds__extract_dayofweek + , subq_13.ds__extract_dayofyear , subq_13.created_at__day , subq_13.created_at__week , subq_13.created_at__month , subq_13.created_at__quarter , subq_13.created_at__year + , subq_13.created_at__extract_year + , subq_13.created_at__extract_quarter + , subq_13.created_at__extract_month + , subq_13.created_at__extract_week + , subq_13.created_at__extract_day + , subq_13.created_at__extract_dayofweek + , subq_13.created_at__extract_dayofyear , subq_13.listing__ds__day , subq_13.listing__ds__week , subq_13.listing__ds__month , subq_13.listing__ds__quarter , subq_13.listing__ds__year + , subq_13.listing__ds__extract_year + , subq_13.listing__ds__extract_quarter + , subq_13.listing__ds__extract_month + , subq_13.listing__ds__extract_week + , subq_13.listing__ds__extract_day + , subq_13.listing__ds__extract_dayofweek + , subq_13.listing__ds__extract_dayofyear , subq_13.listing__created_at__day , subq_13.listing__created_at__week , subq_13.listing__created_at__month , subq_13.listing__created_at__quarter , subq_13.listing__created_at__year + , subq_13.listing__created_at__extract_year + , subq_13.listing__created_at__extract_quarter + , subq_13.listing__created_at__extract_month + , subq_13.listing__created_at__extract_week + , subq_13.listing__created_at__extract_day + , subq_13.listing__created_at__extract_dayofweek + , subq_13.listing__created_at__extract_dayofyear , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month @@ -410,11 +634,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -423,11 +661,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index e424fa31af..b2d5615477 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -47,32 +47,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -99,11 +141,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -112,11 +168,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql index 48583b238a..b6f01861d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql index 4ca35f2544..d480357663 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql @@ -38,32 +38,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql index b515ad2da5..f52c8d6acf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql index 5eb893b84a..4e79154b70 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql index 2393630095..f44071348d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql @@ -18,11 +18,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -40,11 +54,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql index 9ced88e0cc..4c321e73b0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index dd00d2b15e..4821d797fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql index 658dcf3357..2a39c9282f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql index 9bafb5e1f6..82ded0a878 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -170,31 +254,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -244,32 +370,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql index edbbe545fd..f21c6e33a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index c97b8fd930..34b929887f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql index 03b1c29282..44073119ae 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 6a32edb464..66bd68c2c6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index d52164ec94..9ab70d9a6a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -235,31 +361,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,31 +463,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -369,32 +579,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 1a2a3259ba..34b0e577f7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -236,31 +362,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,31 +464,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -370,32 +580,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql index edd3eef59c..390f041085 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_4.ds__month AS ds__month , subq_4.ds__quarter AS ds__quarter , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_week AS ds__extract_week + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_4.ds__extract_dayofyear AS ds__extract_dayofyear , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , subq_4.ds_partitioned__year AS ds_partitioned__year + , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_4.paid_at__day AS paid_at__day , subq_4.paid_at__week AS paid_at__week , subq_4.paid_at__month AS paid_at__month , subq_4.paid_at__quarter AS paid_at__quarter , subq_4.paid_at__year AS paid_at__year + , subq_4.paid_at__extract_year AS paid_at__extract_year + , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_4.paid_at__extract_month AS paid_at__extract_month + , subq_4.paid_at__extract_week AS paid_at__extract_week + , subq_4.paid_at__extract_day AS paid_at__extract_day + , subq_4.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_4.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_4.booking__ds__day AS booking__ds__day , subq_4.booking__ds__week AS booking__ds__week , subq_4.booking__ds__month AS booking__ds__month , subq_4.booking__ds__quarter AS booking__ds__quarter , subq_4.booking__ds__year AS booking__ds__year + , subq_4.booking__ds__extract_year AS booking__ds__extract_year + , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_4.booking__ds__extract_month AS booking__ds__extract_month + , subq_4.booking__ds__extract_week AS booking__ds__extract_week + , subq_4.booking__ds__extract_day AS booking__ds__extract_day + , subq_4.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_4.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_4.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_4.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_4.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_4.booking__paid_at__day AS booking__paid_at__day , subq_4.booking__paid_at__week AS booking__paid_at__week , subq_4.booking__paid_at__month AS booking__paid_at__month , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter , subq_4.booking__paid_at__year AS booking__paid_at__year + , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_4.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_4.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_4.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,31 +130,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , 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 @@ -152,31 +236,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -226,32 +352,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql index 26c360ab9e..3c8d87a17b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,31 +129,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -161,32 +245,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql index 870b2c80ea..3adff18e62 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_distinct_values__plan0.sql @@ -42,31 +42,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -116,32 +158,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -166,21 +250,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -209,11 +321,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -222,11 +348,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql index ddba65921c..00efad0383 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql @@ -25,32 +25,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql index 7ce1a71c7f..7e0fdff19e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql index 81e6d39ada..eb70f04221 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -48,31 +48,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -122,32 +164,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -172,21 +256,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -215,11 +327,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -228,11 +354,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql index 4caa3d07f0..d1428aa84b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0.sql @@ -31,7 +31,7 @@ FROM ( SELECT subq_2.metric_time__day AS metric_time__day , subq_4.window_start__day AS listing__window_start__day - , subq_4.window_end__day AS listing__window_end__day + , subq_4.window_end__extract_month AS listing__window_end__extract_month , subq_2.listing AS listing , subq_4.capacity AS listing__capacity , subq_2.bookings AS bookings @@ -50,31 +50,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -110,32 +152,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -153,7 +237,7 @@ FROM ( -- ['capacity', 'window_start__day', 'window_end__day', 'listing'] SELECT subq_3.window_start__day - , subq_3.window_end__day + , subq_3.window_end__extract_month , subq_3.listing , subq_3.capacity FROM ( @@ -164,11 +248,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +275,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -199,9 +311,9 @@ FROM ( subq_2.metric_time__day >= subq_4.window_start__day ) AND ( ( - subq_2.metric_time__day < subq_4.window_end__day + subq_2.metric_time__day < subq_4.window_end__extract_month ) OR ( - subq_4.window_end__day IS NULL + subq_4.window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql index 86a2010b35..80def52955 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_scd_dimension__plan0_optimized.sql @@ -35,9 +35,9 @@ FROM ( subq_12.metric_time__day >= listings_src_10017.active_from ) AND ( ( - subq_12.metric_time__day < listings_src_10017.active_to + subq_12.metric_time__day < EXTRACT(MONTH FROM listings_src_10017.active_to) ) OR ( - listings_src_10017.active_to IS NULL + EXTRACT(MONTH FROM listings_src_10017.active_to) IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 6ed1bd4e99..6ef8853985 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql index 22702f0c48..29fb5d972e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql index 027f20ea5b..16e8afe8d0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql index 913fed793c..b00d690648 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_limit_rows__plan0.sql @@ -26,31 +26,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql index 86b30c4553..583b4a4bf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_local_dimension_using_local_entity__plan0.sql @@ -21,21 +21,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.created_at__day , subq_0.created_at__week , subq_0.created_at__month , subq_0.created_at__quarter , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_week + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dayofweek + , subq_0.created_at__extract_dayofyear , subq_0.listing__ds__day , subq_0.listing__ds__week , subq_0.listing__ds__month , subq_0.listing__ds__quarter , subq_0.listing__ds__year + , subq_0.listing__ds__extract_year + , subq_0.listing__ds__extract_quarter + , subq_0.listing__ds__extract_month + , subq_0.listing__ds__extract_week + , subq_0.listing__ds__extract_day + , subq_0.listing__ds__extract_dayofweek + , subq_0.listing__ds__extract_dayofyear , subq_0.listing__created_at__day , subq_0.listing__created_at__week , subq_0.listing__created_at__month , subq_0.listing__created_at__quarter , subq_0.listing__created_at__year + , subq_0.listing__created_at__extract_year + , subq_0.listing__created_at__extract_quarter + , subq_0.listing__created_at__extract_month + , subq_0.listing__created_at__extract_week + , subq_0.listing__created_at__extract_day + , subq_0.listing__created_at__extract_dayofweek + , subq_0.listing__created_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -77,11 +119,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql index 316737d00a..b05da97264 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql @@ -35,32 +35,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql index 73e6a70d92..437dc887b4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint__plan0.sql @@ -60,31 +60,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -134,32 +176,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -184,21 +268,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -227,11 +339,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -240,11 +366,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -317,31 +457,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -391,32 +573,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -441,21 +665,49 @@ FROM ( , subq_15.ds__month , subq_15.ds__quarter , subq_15.ds__year + , subq_15.ds__extract_year + , subq_15.ds__extract_quarter + , subq_15.ds__extract_month + , subq_15.ds__extract_week + , subq_15.ds__extract_day + , subq_15.ds__extract_dayofweek + , subq_15.ds__extract_dayofyear , subq_15.created_at__day , subq_15.created_at__week , subq_15.created_at__month , subq_15.created_at__quarter , subq_15.created_at__year + , subq_15.created_at__extract_year + , subq_15.created_at__extract_quarter + , subq_15.created_at__extract_month + , subq_15.created_at__extract_week + , subq_15.created_at__extract_day + , subq_15.created_at__extract_dayofweek + , subq_15.created_at__extract_dayofyear , subq_15.listing__ds__day , subq_15.listing__ds__week , subq_15.listing__ds__month , subq_15.listing__ds__quarter , subq_15.listing__ds__year + , subq_15.listing__ds__extract_year + , subq_15.listing__ds__extract_quarter + , subq_15.listing__ds__extract_month + , subq_15.listing__ds__extract_week + , subq_15.listing__ds__extract_day + , subq_15.listing__ds__extract_dayofweek + , subq_15.listing__ds__extract_dayofyear , subq_15.listing__created_at__day , subq_15.listing__created_at__week , subq_15.listing__created_at__month , subq_15.listing__created_at__quarter , subq_15.listing__created_at__year + , subq_15.listing__created_at__extract_year + , subq_15.listing__created_at__extract_quarter + , subq_15.listing__created_at__extract_month + , subq_15.listing__created_at__extract_week + , subq_15.listing__created_at__extract_day + , subq_15.listing__created_at__extract_dayofweek + , subq_15.listing__created_at__extract_dayofyear , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month @@ -484,11 +736,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -497,11 +763,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -557,31 +837,73 @@ FROM ( , subq_24.ds__month , subq_24.ds__quarter , subq_24.ds__year + , subq_24.ds__extract_year + , subq_24.ds__extract_quarter + , subq_24.ds__extract_month + , subq_24.ds__extract_week + , subq_24.ds__extract_day + , subq_24.ds__extract_dayofweek + , subq_24.ds__extract_dayofyear , subq_24.ds_partitioned__day , subq_24.ds_partitioned__week , subq_24.ds_partitioned__month , subq_24.ds_partitioned__quarter , subq_24.ds_partitioned__year + , subq_24.ds_partitioned__extract_year + , subq_24.ds_partitioned__extract_quarter + , subq_24.ds_partitioned__extract_month + , subq_24.ds_partitioned__extract_week + , subq_24.ds_partitioned__extract_day + , subq_24.ds_partitioned__extract_dayofweek + , subq_24.ds_partitioned__extract_dayofyear , subq_24.paid_at__day , subq_24.paid_at__week , subq_24.paid_at__month , subq_24.paid_at__quarter , subq_24.paid_at__year + , subq_24.paid_at__extract_year + , subq_24.paid_at__extract_quarter + , subq_24.paid_at__extract_month + , subq_24.paid_at__extract_week + , subq_24.paid_at__extract_day + , subq_24.paid_at__extract_dayofweek + , subq_24.paid_at__extract_dayofyear , subq_24.booking__ds__day , subq_24.booking__ds__week , subq_24.booking__ds__month , subq_24.booking__ds__quarter , subq_24.booking__ds__year + , subq_24.booking__ds__extract_year + , subq_24.booking__ds__extract_quarter + , subq_24.booking__ds__extract_month + , subq_24.booking__ds__extract_week + , subq_24.booking__ds__extract_day + , subq_24.booking__ds__extract_dayofweek + , subq_24.booking__ds__extract_dayofyear , subq_24.booking__ds_partitioned__day , subq_24.booking__ds_partitioned__week , subq_24.booking__ds_partitioned__month , subq_24.booking__ds_partitioned__quarter , subq_24.booking__ds_partitioned__year + , subq_24.booking__ds_partitioned__extract_year + , subq_24.booking__ds_partitioned__extract_quarter + , subq_24.booking__ds_partitioned__extract_month + , subq_24.booking__ds_partitioned__extract_week + , subq_24.booking__ds_partitioned__extract_day + , subq_24.booking__ds_partitioned__extract_dayofweek + , subq_24.booking__ds_partitioned__extract_dayofyear , subq_24.booking__paid_at__day , subq_24.booking__paid_at__week , subq_24.booking__paid_at__month , subq_24.booking__paid_at__quarter , subq_24.booking__paid_at__year + , subq_24.booking__paid_at__extract_year + , subq_24.booking__paid_at__extract_quarter + , subq_24.booking__paid_at__extract_month + , subq_24.booking__paid_at__extract_week + , subq_24.booking__paid_at__extract_day + , subq_24.booking__paid_at__extract_dayofweek + , subq_24.booking__paid_at__extract_dayofyear , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month @@ -631,32 +953,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql index f951333a58..9626242169 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0.sql @@ -45,31 +45,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -119,32 +161,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -186,31 +270,73 @@ FROM ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.ds_partitioned__day , subq_7.ds_partitioned__week , subq_7.ds_partitioned__month , subq_7.ds_partitioned__quarter , subq_7.ds_partitioned__year + , subq_7.ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_week + , subq_7.ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dayofweek + , subq_7.ds_partitioned__extract_dayofyear , subq_7.paid_at__day , subq_7.paid_at__week , subq_7.paid_at__month , subq_7.paid_at__quarter , subq_7.paid_at__year + , subq_7.paid_at__extract_year + , subq_7.paid_at__extract_quarter + , subq_7.paid_at__extract_month + , subq_7.paid_at__extract_week + , subq_7.paid_at__extract_day + , subq_7.paid_at__extract_dayofweek + , subq_7.paid_at__extract_dayofyear , subq_7.booking__ds__day , subq_7.booking__ds__week , subq_7.booking__ds__month , subq_7.booking__ds__quarter , subq_7.booking__ds__year + , subq_7.booking__ds__extract_year + , subq_7.booking__ds__extract_quarter + , subq_7.booking__ds__extract_month + , subq_7.booking__ds__extract_week + , subq_7.booking__ds__extract_day + , subq_7.booking__ds__extract_dayofweek + , subq_7.booking__ds__extract_dayofyear , subq_7.booking__ds_partitioned__day , subq_7.booking__ds_partitioned__week , subq_7.booking__ds_partitioned__month , subq_7.booking__ds_partitioned__quarter , subq_7.booking__ds_partitioned__year + , subq_7.booking__ds_partitioned__extract_year + , subq_7.booking__ds_partitioned__extract_quarter + , subq_7.booking__ds_partitioned__extract_month + , subq_7.booking__ds_partitioned__extract_week + , subq_7.booking__ds_partitioned__extract_day + , subq_7.booking__ds_partitioned__extract_dayofweek + , subq_7.booking__ds_partitioned__extract_dayofyear , subq_7.booking__paid_at__day , subq_7.booking__paid_at__week , subq_7.booking__paid_at__month , subq_7.booking__paid_at__quarter , subq_7.booking__paid_at__year + , subq_7.booking__paid_at__extract_year + , subq_7.booking__paid_at__extract_quarter + , subq_7.booking__paid_at__extract_month + , subq_7.booking__paid_at__extract_week + , subq_7.booking__paid_at__extract_day + , subq_7.booking__paid_at__extract_dayofweek + , subq_7.booking__paid_at__extract_dayofyear , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month @@ -260,32 +386,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 13d80a91d0..a495423238 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -39,31 +39,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -113,32 +155,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index e05efe9cf1..c868e3cfd9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -160,21 +244,49 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.created_at__day , subq_5.created_at__week , subq_5.created_at__month , subq_5.created_at__quarter , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_week + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dayofweek + , subq_5.created_at__extract_dayofyear , subq_5.listing__ds__day , subq_5.listing__ds__week , subq_5.listing__ds__month , subq_5.listing__ds__quarter , subq_5.listing__ds__year + , subq_5.listing__ds__extract_year + , subq_5.listing__ds__extract_quarter + , subq_5.listing__ds__extract_month + , subq_5.listing__ds__extract_week + , subq_5.listing__ds__extract_day + , subq_5.listing__ds__extract_dayofweek + , subq_5.listing__ds__extract_dayofyear , subq_5.listing__created_at__day , subq_5.listing__created_at__week , subq_5.listing__created_at__month , subq_5.listing__created_at__quarter , subq_5.listing__created_at__year + , subq_5.listing__created_at__extract_year + , subq_5.listing__created_at__extract_quarter + , subq_5.listing__created_at__extract_month + , subq_5.listing__created_at__extract_week + , subq_5.listing__created_at__extract_day + , subq_5.listing__created_at__extract_dayofweek + , subq_5.listing__created_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -203,11 +315,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -216,11 +342,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql index 88cc0b431d..e711d6d43d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql @@ -21,7 +21,7 @@ FROM ( SELECT subq_2.metric_time__day AS metric_time__day , subq_7.window_start__day AS listing__window_start__day - , subq_7.window_end__day AS listing__window_end__day + , subq_7.window_end__extract_month AS listing__window_end__extract_month , subq_2.listing AS listing , subq_7.user__home_state_latest AS listing__user__home_state_latest , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -143,7 +227,7 @@ FROM ( -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT subq_6.window_start__day - , subq_6.window_end__day + , subq_6.window_end__extract_month , subq_6.listing , subq_6.user__home_state_latest FROM ( @@ -154,26 +238,61 @@ FROM ( , subq_3.window_start__month AS window_start__month , subq_3.window_start__quarter AS window_start__quarter , subq_3.window_start__year AS window_start__year + , subq_3.window_start__extract_year AS window_start__extract_year + , subq_3.window_start__extract_quarter AS window_start__extract_quarter + , subq_3.window_start__extract_month AS window_start__extract_month + , subq_3.window_start__extract_week AS window_start__extract_week + , subq_3.window_start__extract_day AS window_start__extract_day + , subq_3.window_start__extract_dayofweek AS window_start__extract_dayofweek + , subq_3.window_start__extract_dayofyear AS window_start__extract_dayofyear , subq_3.window_end__day AS window_end__day , subq_3.window_end__week AS window_end__week , subq_3.window_end__month AS window_end__month , subq_3.window_end__quarter AS window_end__quarter , subq_3.window_end__year AS window_end__year + , subq_3.window_end__extract_year AS window_end__extract_year + , subq_3.window_end__extract_quarter AS window_end__extract_quarter + , subq_3.window_end__extract_month AS window_end__extract_month + , subq_3.window_end__extract_week AS window_end__extract_week + , subq_3.window_end__extract_day AS window_end__extract_day + , subq_3.window_end__extract_dayofweek AS window_end__extract_dayofweek + , subq_3.window_end__extract_dayofyear AS window_end__extract_dayofyear , subq_3.listing__window_start__day AS listing__window_start__day , subq_3.listing__window_start__week AS listing__window_start__week , subq_3.listing__window_start__month AS listing__window_start__month , subq_3.listing__window_start__quarter AS listing__window_start__quarter , subq_3.listing__window_start__year AS listing__window_start__year + , subq_3.listing__window_start__extract_year AS listing__window_start__extract_year + , subq_3.listing__window_start__extract_quarter AS listing__window_start__extract_quarter + , subq_3.listing__window_start__extract_month AS listing__window_start__extract_month + , subq_3.listing__window_start__extract_week AS listing__window_start__extract_week + , subq_3.listing__window_start__extract_day AS listing__window_start__extract_day + , subq_3.listing__window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_3.listing__window_start__extract_dayofyear AS listing__window_start__extract_dayofyear , subq_3.listing__window_end__day AS listing__window_end__day , subq_3.listing__window_end__week AS listing__window_end__week , subq_3.listing__window_end__month AS listing__window_end__month , subq_3.listing__window_end__quarter AS listing__window_end__quarter , subq_3.listing__window_end__year AS listing__window_end__year + , subq_3.listing__window_end__extract_year AS listing__window_end__extract_year + , subq_3.listing__window_end__extract_quarter AS listing__window_end__extract_quarter + , subq_3.listing__window_end__extract_month AS listing__window_end__extract_month + , subq_3.listing__window_end__extract_week AS listing__window_end__extract_week + , subq_3.listing__window_end__extract_day AS listing__window_end__extract_day + , subq_3.listing__window_end__extract_dayofweek AS listing__window_end__extract_dayofweek + , subq_3.listing__window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dayofweek AS user__ds__extract_dayofweek + , subq_5.ds__extract_dayofyear AS user__ds__extract_dayofyear , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +311,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +338,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -227,11 +374,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +400,25 @@ FROM ( , subq_4.ds__month , subq_4.ds__quarter , subq_4.ds__year + , subq_4.ds__extract_year + , subq_4.ds__extract_quarter + , subq_4.ds__extract_month + , subq_4.ds__extract_week + , subq_4.ds__extract_day + , subq_4.ds__extract_dayofweek + , subq_4.ds__extract_dayofyear , subq_4.user__ds__day , subq_4.user__ds__week , subq_4.user__ds__month , subq_4.user__ds__quarter , subq_4.user__ds__year + , subq_4.user__ds__extract_year + , subq_4.user__ds__extract_quarter + , subq_4.user__ds__extract_month + , subq_4.user__ds__extract_week + , subq_4.user__ds__extract_day + , subq_4.user__ds__extract_dayofweek + , subq_4.user__ds__extract_dayofyear , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +430,26 @@ FROM ( , DATE_TRUNC('month', users_latest_src_10021.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS ds__extract_dayofyear , users_latest_src_10021.home_state_latest , users_latest_src_10021.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10021.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10021.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS user__ds__extract_dayofyear , users_latest_src_10021.home_state_latest AS user__home_state_latest , users_latest_src_10021.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10021 @@ -278,9 +467,9 @@ FROM ( subq_2.metric_time__day >= subq_7.window_start__day ) AND ( ( - subq_2.metric_time__day < subq_7.window_end__day + subq_2.metric_time__day < subq_7.window_end__extract_month ) OR ( - subq_7.window_end__day IS NULL + subq_7.window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql index feb5ed0fdc..a0a10936fd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -24,7 +24,7 @@ LEFT OUTER JOIN ( -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT listings_src_10017.active_from AS window_start__day - , listings_src_10017.active_to AS window_end__day + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month , listings_src_10017.listing_id AS listing , users_latest_src_10021.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings listings_src_10017 @@ -41,9 +41,9 @@ ON subq_13.metric_time__day >= subq_18.window_start__day ) AND ( ( - subq_13.metric_time__day < subq_18.window_end__day + subq_13.metric_time__day < subq_18.window_end__extract_month ) OR ( - subq_18.window_end__day IS NULL + subq_18.window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql index 94054a124c..7647395b42 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.lux_listing__window_start__day AS listing__lux_listing__window_start__day - , subq_7.lux_listing__window_end__day AS listing__lux_listing__window_end__day + , subq_7.lux_listing__window_start__extract_year AS listing__lux_listing__window_start__extract_year + , subq_7.lux_listing__window_end__extract_quarter AS listing__lux_listing__window_end__extract_quarter , subq_2.listing AS listing , subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -145,8 +229,8 @@ FROM ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - subq_6.lux_listing__window_start__day - , subq_6.lux_listing__window_end__day + subq_6.lux_listing__window_start__extract_year + , subq_6.lux_listing__window_end__extract_quarter , subq_6.listing , subq_6.lux_listing__is_confirmed_lux FROM ( @@ -157,11 +241,25 @@ FROM ( , subq_5.window_start__month AS lux_listing__window_start__month , subq_5.window_start__quarter AS lux_listing__window_start__quarter , subq_5.window_start__year AS lux_listing__window_start__year + , subq_5.window_start__extract_year AS lux_listing__window_start__extract_year + , subq_5.window_start__extract_quarter AS lux_listing__window_start__extract_quarter + , subq_5.window_start__extract_month AS lux_listing__window_start__extract_month + , subq_5.window_start__extract_week AS lux_listing__window_start__extract_week + , subq_5.window_start__extract_day AS lux_listing__window_start__extract_day + , subq_5.window_start__extract_dayofweek AS lux_listing__window_start__extract_dayofweek + , subq_5.window_start__extract_dayofyear AS lux_listing__window_start__extract_dayofyear , subq_5.window_end__day AS lux_listing__window_end__day , subq_5.window_end__week AS lux_listing__window_end__week , subq_5.window_end__month AS lux_listing__window_end__month , subq_5.window_end__quarter AS lux_listing__window_end__quarter , subq_5.window_end__year AS lux_listing__window_end__year + , subq_5.window_end__extract_year AS lux_listing__window_end__extract_year + , subq_5.window_end__extract_quarter AS lux_listing__window_end__extract_quarter + , subq_5.window_end__extract_month AS lux_listing__window_end__extract_month + , subq_5.window_end__extract_week AS lux_listing__window_end__extract_week + , subq_5.window_end__extract_day AS lux_listing__window_end__extract_day + , subq_5.window_end__extract_dayofweek AS lux_listing__window_end__extract_dayofweek + , subq_5.window_end__extract_dayofyear AS lux_listing__window_end__extract_dayofyear , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +281,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +331,49 @@ FROM ( , subq_4.window_start__month , subq_4.window_start__quarter , subq_4.window_start__year + , subq_4.window_start__extract_year + , subq_4.window_start__extract_quarter + , subq_4.window_start__extract_month + , subq_4.window_start__extract_week + , subq_4.window_start__extract_day + , subq_4.window_start__extract_dayofweek + , subq_4.window_start__extract_dayofyear , subq_4.window_end__day , subq_4.window_end__week , subq_4.window_end__month , subq_4.window_end__quarter , subq_4.window_end__year + , subq_4.window_end__extract_year + , subq_4.window_end__extract_quarter + , subq_4.window_end__extract_month + , subq_4.window_end__extract_week + , subq_4.window_end__extract_day + , subq_4.window_end__extract_dayofweek + , subq_4.window_end__extract_dayofyear , subq_4.lux_listing__window_start__day , subq_4.lux_listing__window_start__week , subq_4.lux_listing__window_start__month , subq_4.lux_listing__window_start__quarter , subq_4.lux_listing__window_start__year + , subq_4.lux_listing__window_start__extract_year + , subq_4.lux_listing__window_start__extract_quarter + , subq_4.lux_listing__window_start__extract_month + , subq_4.lux_listing__window_start__extract_week + , subq_4.lux_listing__window_start__extract_day + , subq_4.lux_listing__window_start__extract_dayofweek + , subq_4.lux_listing__window_start__extract_dayofyear , subq_4.lux_listing__window_end__day , subq_4.lux_listing__window_end__week , subq_4.lux_listing__window_end__month , subq_4.lux_listing__window_end__quarter , subq_4.lux_listing__window_end__year + , subq_4.lux_listing__window_end__extract_year + , subq_4.lux_listing__window_end__extract_quarter + , subq_4.lux_listing__window_end__extract_month + , subq_4.lux_listing__window_end__extract_week + , subq_4.lux_listing__window_end__extract_day + , subq_4.lux_listing__window_end__extract_dayofweek + , subq_4.lux_listing__window_end__extract_dayofyear , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +385,50 @@ FROM ( , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux , lux_listings_src_10019.valid_from AS lux_listing__window_start__day , DATE_TRUNC('week', lux_listings_src_10019.valid_from) AS lux_listing__window_start__week , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS lux_listing__window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS lux_listing__window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS lux_listing__window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS lux_listing__window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS lux_listing__window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS lux_listing__window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS lux_listing__window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS lux_listing__window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux , lux_listings_src_10019.lux_listing_id AS lux_listing FROM ***************************.dim_lux_listings lux_listings_src_10019 @@ -261,12 +443,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.lux_listing__window_start__day + subq_2.metric_time__day >= subq_7.lux_listing__window_start__extract_year ) AND ( ( - subq_2.metric_time__day < subq_7.lux_listing__window_end__day + subq_2.metric_time__day < subq_7.lux_listing__window_end__extract_quarter ) OR ( - subq_7.lux_listing__window_end__day IS NULL + subq_7.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql index f1b419a284..0d00fd3b9a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -26,8 +26,8 @@ LEFT OUTER JOIN ( -- 'lux_listing__window_end__day', -- 'listing'] SELECT - lux_listings_src_10019.valid_from AS lux_listing__window_start__day - , lux_listings_src_10019.valid_to AS lux_listing__window_end__day + EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter , lux_listing_mapping_src_10018.listing_id AS listing , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10018 @@ -41,12 +41,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.lux_listing__window_start__day + subq_13.metric_time__day >= subq_18.lux_listing__window_start__extract_year ) AND ( ( - subq_13.metric_time__day < subq_18.lux_listing__window_end__day + subq_13.metric_time__day < subq_18.lux_listing__window_end__extract_quarter ) OR ( - subq_18.lux_listing__window_end__day IS NULL + subq_18.lux_listing__window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql index ae8b7838b7..cb9670f074 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql @@ -33,32 +33,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -85,11 +127,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -98,11 +154,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -131,11 +201,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -144,11 +228,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql index d35179ebf0..fbddd59f54 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.ds__day , subq_0.ds__week , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.account_id__ds_partitioned__day , subq_0.account_id__ds_partitioned__week , subq_0.account_id__ds_partitioned__month , subq_0.account_id__ds_partitioned__quarter , subq_0.account_id__ds_partitioned__year + , subq_0.account_id__ds_partitioned__extract_year + , subq_0.account_id__ds_partitioned__extract_quarter + , subq_0.account_id__ds_partitioned__extract_month + , subq_0.account_id__ds_partitioned__extract_week + , subq_0.account_id__ds_partitioned__extract_day + , subq_0.account_id__ds_partitioned__extract_dayofweek + , subq_0.account_id__ds_partitioned__extract_dayofyear , subq_0.account_id__ds__day , subq_0.account_id__ds__week , subq_0.account_id__ds__month , subq_0.account_id__ds__quarter , subq_0.account_id__ds__year + , subq_0.account_id__ds__extract_year + , subq_0.account_id__ds__extract_quarter + , subq_0.account_id__ds__extract_month + , subq_0.account_id__ds__extract_week + , subq_0.account_id__ds__extract_day + , subq_0.account_id__ds__extract_dayofweek + , subq_0.account_id__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -69,22 +97,50 @@ FROM ( , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS ds__extract_dayofyear , account_month_txns_src_10010.account_month , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS account_id__ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS account_id__ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS account_id__ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS account_id__ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS account_id__ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofyear , account_month_txns_src_10010.account_month AS account_id__account_month , account_month_txns_src_10010.account_id FROM ***************************.account_month_txns account_month_txns_src_10010 @@ -106,16 +162,37 @@ FROM ( , subq_3.ds_partitioned__month AS ds_partitioned__month , subq_3.ds_partitioned__quarter AS ds_partitioned__quarter , subq_3.ds_partitioned__year AS ds_partitioned__year + , subq_3.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_3.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_3.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_3.account_id__ds_partitioned__day AS account_id__ds_partitioned__day , subq_3.account_id__ds_partitioned__week AS account_id__ds_partitioned__week , subq_3.account_id__ds_partitioned__month AS account_id__ds_partitioned__month , subq_3.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter , subq_3.account_id__ds_partitioned__year AS account_id__ds_partitioned__year + , subq_3.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year + , subq_3.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter + , subq_3.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month + , subq_3.account_id__ds_partitioned__extract_week AS account_id__ds_partitioned__extract_week + , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day + , subq_3.account_id__ds_partitioned__extract_dayofweek AS account_id__ds_partitioned__extract_dayofweek + , subq_3.account_id__ds_partitioned__extract_dayofyear AS account_id__ds_partitioned__extract_dayofyear , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month , subq_5.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter , subq_5.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_5.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week AS customer_id__ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek AS customer_id__ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear AS customer_id__ds_partitioned__extract_dayofyear , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id @@ -132,12 +209,26 @@ FROM ( , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofyear , bridge_table_src_10011.extra_dim AS account_id__extra_dim , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id @@ -154,11 +245,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +271,25 @@ FROM ( , subq_4.ds_partitioned__month , subq_4.ds_partitioned__quarter , subq_4.ds_partitioned__year + , subq_4.ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear , subq_4.customer_id__ds_partitioned__day , subq_4.customer_id__ds_partitioned__week , subq_4.customer_id__ds_partitioned__month , subq_4.customer_id__ds_partitioned__quarter , subq_4.customer_id__ds_partitioned__year + , subq_4.customer_id__ds_partitioned__extract_year + , subq_4.customer_id__ds_partitioned__extract_quarter + , subq_4.customer_id__ds_partitioned__extract_month + , subq_4.customer_id__ds_partitioned__extract_week + , subq_4.customer_id__ds_partitioned__extract_day + , subq_4.customer_id__ds_partitioned__extract_dayofweek + , subq_4.customer_id__ds_partitioned__extract_dayofyear , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +305,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_name AS customer_id__customer_name , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned__day @@ -193,6 +319,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_id FROM ***************************.customer_table customer_table_src_10013 ) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql index 5c9089deaf..eb31a4fb3a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multiple_metrics_no_dimensions__plan0.sql @@ -23,31 +23,73 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.ds_partitioned__day , subq_1.ds_partitioned__week , subq_1.ds_partitioned__month , subq_1.ds_partitioned__quarter , subq_1.ds_partitioned__year + , subq_1.ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear , subq_1.paid_at__day , subq_1.paid_at__week , subq_1.paid_at__month , subq_1.paid_at__quarter , subq_1.paid_at__year + , subq_1.paid_at__extract_year + , subq_1.paid_at__extract_quarter + , subq_1.paid_at__extract_month + , subq_1.paid_at__extract_week + , subq_1.paid_at__extract_day + , subq_1.paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear , subq_1.booking__ds__day , subq_1.booking__ds__week , subq_1.booking__ds__month , subq_1.booking__ds__quarter , subq_1.booking__ds__year + , subq_1.booking__ds__extract_year + , subq_1.booking__ds__extract_quarter + , subq_1.booking__ds__extract_month + , subq_1.booking__ds__extract_week + , subq_1.booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear , subq_1.booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month , subq_1.booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day , subq_1.booking__paid_at__week , subq_1.booking__paid_at__month , subq_1.booking__paid_at__quarter , subq_1.booking__paid_at__year + , subq_1.booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -82,31 +124,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -156,32 +240,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -217,21 +343,49 @@ CROSS JOIN ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.created_at__day , subq_7.created_at__week , subq_7.created_at__month , subq_7.created_at__quarter , subq_7.created_at__year + , subq_7.created_at__extract_year + , subq_7.created_at__extract_quarter + , subq_7.created_at__extract_month + , subq_7.created_at__extract_week + , subq_7.created_at__extract_day + , subq_7.created_at__extract_dayofweek + , subq_7.created_at__extract_dayofyear , subq_7.listing__ds__day , subq_7.listing__ds__week , subq_7.listing__ds__month , subq_7.listing__ds__quarter , subq_7.listing__ds__year + , subq_7.listing__ds__extract_year + , subq_7.listing__ds__extract_quarter + , subq_7.listing__ds__extract_month + , subq_7.listing__ds__extract_week + , subq_7.listing__ds__extract_day + , subq_7.listing__ds__extract_dayofweek + , subq_7.listing__ds__extract_dayofyear , subq_7.listing__created_at__day , subq_7.listing__created_at__week , subq_7.listing__created_at__month , subq_7.listing__created_at__quarter , subq_7.listing__created_at__year + , subq_7.listing__created_at__extract_year + , subq_7.listing__created_at__extract_quarter + , subq_7.listing__created_at__extract_month + , subq_7.listing__created_at__extract_week + , subq_7.listing__created_at__extract_day + , subq_7.listing__created_at__extract_dayofweek + , subq_7.listing__created_at__extract_dayofyear , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month @@ -257,21 +411,49 @@ CROSS JOIN ( , subq_6.ds__month , subq_6.ds__quarter , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_week + , subq_6.ds__extract_day + , subq_6.ds__extract_dayofweek + , subq_6.ds__extract_dayofyear , subq_6.created_at__day , subq_6.created_at__week , subq_6.created_at__month , subq_6.created_at__quarter , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_week + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dayofweek + , subq_6.created_at__extract_dayofyear , subq_6.listing__ds__day , subq_6.listing__ds__week , subq_6.listing__ds__month , subq_6.listing__ds__quarter , subq_6.listing__ds__year + , subq_6.listing__ds__extract_year + , subq_6.listing__ds__extract_quarter + , subq_6.listing__ds__extract_month + , subq_6.listing__ds__extract_week + , subq_6.listing__ds__extract_day + , subq_6.listing__ds__extract_dayofweek + , subq_6.listing__ds__extract_dayofyear , subq_6.listing__created_at__day , subq_6.listing__created_at__week , subq_6.listing__created_at__month , subq_6.listing__created_at__quarter , subq_6.listing__created_at__year + , subq_6.listing__created_at__extract_year + , subq_6.listing__created_at__extract_quarter + , subq_6.listing__created_at__extract_month + , subq_6.listing__created_at__extract_week + , subq_6.listing__created_at__extract_day + , subq_6.listing__created_at__extract_dayofweek + , subq_6.listing__created_at__extract_dayofyear , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month @@ -300,11 +482,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -313,11 +509,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql index 14a9f0385a..dc0afd0f09 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_nested_derived_metric__plan0.sql @@ -44,31 +44,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -118,32 +160,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -182,31 +266,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -256,32 +382,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -332,31 +500,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -406,32 +616,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -480,31 +732,73 @@ FROM ( , subq_17.ds__month , subq_17.ds__quarter , subq_17.ds__year + , subq_17.ds__extract_year + , subq_17.ds__extract_quarter + , subq_17.ds__extract_month + , subq_17.ds__extract_week + , subq_17.ds__extract_day + , subq_17.ds__extract_dayofweek + , subq_17.ds__extract_dayofyear , subq_17.ds_partitioned__day , subq_17.ds_partitioned__week , subq_17.ds_partitioned__month , subq_17.ds_partitioned__quarter , subq_17.ds_partitioned__year + , subq_17.ds_partitioned__extract_year + , subq_17.ds_partitioned__extract_quarter + , subq_17.ds_partitioned__extract_month + , subq_17.ds_partitioned__extract_week + , subq_17.ds_partitioned__extract_day + , subq_17.ds_partitioned__extract_dayofweek + , subq_17.ds_partitioned__extract_dayofyear , subq_17.paid_at__day , subq_17.paid_at__week , subq_17.paid_at__month , subq_17.paid_at__quarter , subq_17.paid_at__year + , subq_17.paid_at__extract_year + , subq_17.paid_at__extract_quarter + , subq_17.paid_at__extract_month + , subq_17.paid_at__extract_week + , subq_17.paid_at__extract_day + , subq_17.paid_at__extract_dayofweek + , subq_17.paid_at__extract_dayofyear , subq_17.booking__ds__day , subq_17.booking__ds__week , subq_17.booking__ds__month , subq_17.booking__ds__quarter , subq_17.booking__ds__year + , subq_17.booking__ds__extract_year + , subq_17.booking__ds__extract_quarter + , subq_17.booking__ds__extract_month + , subq_17.booking__ds__extract_week + , subq_17.booking__ds__extract_day + , subq_17.booking__ds__extract_dayofweek + , subq_17.booking__ds__extract_dayofyear , subq_17.booking__ds_partitioned__day , subq_17.booking__ds_partitioned__week , subq_17.booking__ds_partitioned__month , subq_17.booking__ds_partitioned__quarter , subq_17.booking__ds_partitioned__year + , subq_17.booking__ds_partitioned__extract_year + , subq_17.booking__ds_partitioned__extract_quarter + , subq_17.booking__ds_partitioned__extract_month + , subq_17.booking__ds_partitioned__extract_week + , subq_17.booking__ds_partitioned__extract_day + , subq_17.booking__ds_partitioned__extract_dayofweek + , subq_17.booking__ds_partitioned__extract_dayofyear , subq_17.booking__paid_at__day , subq_17.booking__paid_at__week , subq_17.booking__paid_at__month , subq_17.booking__paid_at__quarter , subq_17.booking__paid_at__year + , subq_17.booking__paid_at__extract_year + , subq_17.booking__paid_at__extract_quarter + , subq_17.booking__paid_at__extract_month + , subq_17.booking__paid_at__extract_week + , subq_17.booking__paid_at__extract_day + , subq_17.booking__paid_at__extract_dayofweek + , subq_17.booking__paid_at__extract_dayofyear , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month @@ -554,32 +848,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql index be96decab5..63116a5458 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql @@ -45,32 +45,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql index a5288e7009..a53f3a075b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.verification__ds__day , subq_0.verification__ds__week , subq_0.verification__ds__month , subq_0.verification__ds__quarter , subq_0.verification__ds__year + , subq_0.verification__ds__extract_year + , subq_0.verification__ds__extract_quarter + , subq_0.verification__ds__extract_month + , subq_0.verification__ds__extract_week + , subq_0.verification__ds__extract_day + , subq_0.verification__ds__extract_dayofweek + , subq_0.verification__ds__extract_dayofyear , subq_0.verification__ds_partitioned__day , subq_0.verification__ds_partitioned__week , subq_0.verification__ds_partitioned__month , subq_0.verification__ds_partitioned__quarter , subq_0.verification__ds_partitioned__year + , subq_0.verification__ds_partitioned__extract_year + , subq_0.verification__ds_partitioned__extract_quarter + , subq_0.verification__ds_partitioned__extract_month + , subq_0.verification__ds_partitioned__extract_week + , subq_0.verification__ds_partitioned__extract_day + , subq_0.verification__ds_partitioned__extract_dayofweek + , subq_0.verification__ds_partitioned__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -71,22 +99,50 @@ FROM ( , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user @@ -110,32 +166,74 @@ FROM ( , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS ds__extract_dayofyear , users_ds_source_src_10007.created_at AS created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state , users_ds_source_src_10007.ds AS user__ds__day , DATE_TRUNC('week', users_ds_source_src_10007.ds) AS user__ds__week , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS user__ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS user__ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofyear , users_ds_source_src_10007.created_at AS user__created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS user__created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS user__created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS user__created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS user__created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state AS user__home_state , users_ds_source_src_10007.user_id AS user FROM ***************************.dim_users users_ds_source_src_10007 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql index c65a58a300..d88d2d32f3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -54,12 +82,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql index 603dac8609..094486f462 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql index adfa1c3f03..a8a26c9899 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 48a1b43de5..c400372dd4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 08a913aa57..30ab4c1851 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index ed796b148d..ef337f422c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql index 782ccc2826..16b897731d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -83,11 +125,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -96,11 +152,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql index 0f449eb59e..7dd5c3b39d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql index ee19129508..e240956212 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , is_instant AS booking__is_instant , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql index 214766cb17..073c7964da 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_common_semantic_model__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -239,32 +365,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql index 63637a9433..c80b16baf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index 9c4d91d069..d5d52443ea 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -51,31 +51,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -125,32 +167,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -175,21 +259,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -218,11 +330,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -231,11 +357,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -296,21 +436,49 @@ FROM ( , subq_10.ds__month , subq_10.ds__quarter , subq_10.ds__year + , subq_10.ds__extract_year + , subq_10.ds__extract_quarter + , subq_10.ds__extract_month + , subq_10.ds__extract_week + , subq_10.ds__extract_day + , subq_10.ds__extract_dayofweek + , subq_10.ds__extract_dayofyear , subq_10.ds_partitioned__day , subq_10.ds_partitioned__week , subq_10.ds_partitioned__month , subq_10.ds_partitioned__quarter , subq_10.ds_partitioned__year + , subq_10.ds_partitioned__extract_year + , subq_10.ds_partitioned__extract_quarter + , subq_10.ds_partitioned__extract_month + , subq_10.ds_partitioned__extract_week + , subq_10.ds_partitioned__extract_day + , subq_10.ds_partitioned__extract_dayofweek + , subq_10.ds_partitioned__extract_dayofyear , subq_10.view__ds__day , subq_10.view__ds__week , subq_10.view__ds__month , subq_10.view__ds__quarter , subq_10.view__ds__year + , subq_10.view__ds__extract_year + , subq_10.view__ds__extract_quarter + , subq_10.view__ds__extract_month + , subq_10.view__ds__extract_week + , subq_10.view__ds__extract_day + , subq_10.view__ds__extract_dayofweek + , subq_10.view__ds__extract_dayofyear , subq_10.view__ds_partitioned__day , subq_10.view__ds_partitioned__week , subq_10.view__ds_partitioned__month , subq_10.view__ds_partitioned__quarter , subq_10.view__ds_partitioned__year + , subq_10.view__ds_partitioned__extract_year + , subq_10.view__ds_partitioned__extract_quarter + , subq_10.view__ds_partitioned__extract_month + , subq_10.view__ds_partitioned__extract_week + , subq_10.view__ds_partitioned__extract_day + , subq_10.view__ds_partitioned__extract_dayofweek + , subq_10.view__ds_partitioned__extract_dayofyear , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month @@ -330,21 +498,49 @@ FROM ( , DATE_TRUNC('month', views_source_src_10009.ds) AS ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dayofyear , views_source_src_10009.ds AS view__ds__day , DATE_TRUNC('week', views_source_src_10009.ds) AS view__ds__week , DATE_TRUNC('month', views_source_src_10009.ds) AS view__ds__month , DATE_TRUNC('quarter', views_source_src_10009.ds) AS view__ds__quarter , DATE_TRUNC('year', views_source_src_10009.ds) AS view__ds__year + , EXTRACT(YEAR FROM views_source_src_10009.ds) AS view__ds__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds) AS view__ds__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds) AS view__ds__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds) AS view__ds__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds) AS view__ds__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS view__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS view__ds__extract_dayofyear , views_source_src_10009.ds_partitioned AS view__ds_partitioned__day , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__week , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__month , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__quarter , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS view__ds_partitioned__year + , EXTRACT(YEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_month + , EXTRACT(WEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week + , EXTRACT(DAY FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dayofyear , views_source_src_10009.listing_id AS listing , views_source_src_10009.user_id AS user , views_source_src_10009.listing_id AS view__listing @@ -367,21 +563,49 @@ FROM ( , subq_13.ds__month , subq_13.ds__quarter , subq_13.ds__year + , subq_13.ds__extract_year + , subq_13.ds__extract_quarter + , subq_13.ds__extract_month + , subq_13.ds__extract_week + , subq_13.ds__extract_day + , subq_13.ds__extract_dayofweek + , subq_13.ds__extract_dayofyear , subq_13.created_at__day , subq_13.created_at__week , subq_13.created_at__month , subq_13.created_at__quarter , subq_13.created_at__year + , subq_13.created_at__extract_year + , subq_13.created_at__extract_quarter + , subq_13.created_at__extract_month + , subq_13.created_at__extract_week + , subq_13.created_at__extract_day + , subq_13.created_at__extract_dayofweek + , subq_13.created_at__extract_dayofyear , subq_13.listing__ds__day , subq_13.listing__ds__week , subq_13.listing__ds__month , subq_13.listing__ds__quarter , subq_13.listing__ds__year + , subq_13.listing__ds__extract_year + , subq_13.listing__ds__extract_quarter + , subq_13.listing__ds__extract_month + , subq_13.listing__ds__extract_week + , subq_13.listing__ds__extract_day + , subq_13.listing__ds__extract_dayofweek + , subq_13.listing__ds__extract_dayofyear , subq_13.listing__created_at__day , subq_13.listing__created_at__week , subq_13.listing__created_at__month , subq_13.listing__created_at__quarter , subq_13.listing__created_at__year + , subq_13.listing__created_at__extract_year + , subq_13.listing__created_at__extract_quarter + , subq_13.listing__created_at__extract_month + , subq_13.listing__created_at__extract_week + , subq_13.listing__created_at__extract_day + , subq_13.listing__created_at__extract_dayofweek + , subq_13.listing__created_at__extract_dayofyear , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month @@ -410,11 +634,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -423,11 +661,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index dd55a54b61..a56183e745 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -47,32 +47,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -99,11 +141,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -112,11 +168,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql index 48583b238a..b6f01861d7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql @@ -44,32 +44,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -96,11 +138,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -109,11 +165,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql index 4ca35f2544..d480357663 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql @@ -38,32 +38,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql index b515ad2da5..f52c8d6acf 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql index 5eb893b84a..4e79154b70 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql index 2393630095..f44071348d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql @@ -18,11 +18,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -40,11 +54,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql index 9ced88e0cc..4c321e73b0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -43,11 +57,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index dd00d2b15e..4821d797fe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql index 658dcf3357..2a39c9282f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql @@ -21,11 +21,25 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.company__ds__day , subq_1.company__ds__week , subq_1.company__ds__month , subq_1.company__ds__quarter , subq_1.company__ds__year + , subq_1.company__ds__extract_year + , subq_1.company__ds__extract_quarter + , subq_1.company__ds__extract_month + , subq_1.company__ds__extract_week + , subq_1.company__ds__extract_day + , subq_1.company__ds__extract_dayofweek + , subq_1.company__ds__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -42,11 +56,25 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.company__ds__day , subq_0.company__ds__week , subq_0.company__ds__month , subq_0.company__ds__quarter , subq_0.company__ds__year + , subq_0.company__ds__extract_year + , subq_0.company__ds__extract_quarter + , subq_0.company__ds__extract_month + , subq_0.company__ds__extract_week + , subq_0.company__ds__extract_day + , subq_0.company__ds__extract_dayofweek + , subq_0.company__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_dayofyear , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC('week', revenue_src_10006.created_at) AS company__ds__week , DATE_TRUNC('month', revenue_src_10006.created_at) AS company__ds__month , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS company__ds__quarter , DATE_TRUNC('year', revenue_src_10006.created_at) AS company__ds__year + , EXTRACT(YEAR FROM revenue_src_10006.created_at) AS company__ds__extract_year + , EXTRACT(QUARTER FROM revenue_src_10006.created_at) AS company__ds__extract_quarter + , EXTRACT(MONTH FROM revenue_src_10006.created_at) AS company__ds__extract_month + , EXTRACT(WEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(DAY FROM revenue_src_10006.created_at) AS company__ds__extract_day + , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_dayofyear , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql index 9bafb5e1f6..82ded0a878 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -170,31 +254,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -244,32 +370,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql index edbbe545fd..f21c6e33a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index c97b8fd930..34b929887f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql index 03b1c29282..44073119ae 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 6a32edb464..66bd68c2c6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -32,31 +32,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -106,32 +148,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -171,31 +255,73 @@ FROM ( , subq_6.ds__month AS ds__month , subq_6.ds__quarter AS ds__quarter , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_6.ds__extract_dayofyear AS ds__extract_dayofyear , subq_6.ds_partitioned__day AS ds_partitioned__day , subq_6.ds_partitioned__week AS ds_partitioned__week , subq_6.ds_partitioned__month AS ds_partitioned__month , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_6.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_6.paid_at__day AS paid_at__day , subq_6.paid_at__week AS paid_at__week , subq_6.paid_at__month AS paid_at__month , subq_6.paid_at__quarter AS paid_at__quarter , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_6.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_6.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_6.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_6.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_6.booking__paid_at__day AS booking__paid_at__day , subq_6.booking__paid_at__week AS booking__paid_at__week , subq_6.booking__paid_at__month AS booking__paid_at__month , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_6.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,31 +357,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -305,32 +473,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index d52164ec94..9ab70d9a6a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -235,31 +361,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,31 +463,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -369,32 +579,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 1a2a3259ba..34b0e577f7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -33,31 +33,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,31 +135,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -167,32 +251,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -236,31 +362,73 @@ FROM ( , subq_9.ds__month AS ds__month , subq_9.ds__quarter AS ds__quarter , subq_9.ds__year AS ds__year + , subq_9.ds__extract_year AS ds__extract_year + , subq_9.ds__extract_quarter AS ds__extract_quarter + , subq_9.ds__extract_month AS ds__extract_month + , subq_9.ds__extract_week AS ds__extract_week + , subq_9.ds__extract_day AS ds__extract_day + , subq_9.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_9.ds__extract_dayofyear AS ds__extract_dayofyear , subq_9.ds_partitioned__day AS ds_partitioned__day , subq_9.ds_partitioned__week AS ds_partitioned__week , subq_9.ds_partitioned__month AS ds_partitioned__month , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter , subq_9.ds_partitioned__year AS ds_partitioned__year + , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_9.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_9.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_9.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_9.paid_at__day AS paid_at__day , subq_9.paid_at__week AS paid_at__week , subq_9.paid_at__month AS paid_at__month , subq_9.paid_at__quarter AS paid_at__quarter , subq_9.paid_at__year AS paid_at__year + , subq_9.paid_at__extract_year AS paid_at__extract_year + , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_9.paid_at__extract_month AS paid_at__extract_month + , subq_9.paid_at__extract_week AS paid_at__extract_week + , subq_9.paid_at__extract_day AS paid_at__extract_day + , subq_9.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_9.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_9.booking__ds__day AS booking__ds__day , subq_9.booking__ds__week AS booking__ds__week , subq_9.booking__ds__month AS booking__ds__month , subq_9.booking__ds__quarter AS booking__ds__quarter , subq_9.booking__ds__year AS booking__ds__year + , subq_9.booking__ds__extract_year AS booking__ds__extract_year + , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_9.booking__ds__extract_month AS booking__ds__extract_month + , subq_9.booking__ds__extract_week AS booking__ds__extract_week + , subq_9.booking__ds__extract_day AS booking__ds__extract_day + , subq_9.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_9.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_9.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_9.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_9.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_9.booking__paid_at__day AS booking__paid_at__day , subq_9.booking__paid_at__week AS booking__paid_at__week , subq_9.booking__paid_at__month AS booking__paid_at__month , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter , subq_9.booking__paid_at__year AS booking__paid_at__year + , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_9.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_9.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_9.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,31 +464,73 @@ FROM ( , subq_8.ds__month , subq_8.ds__quarter , subq_8.ds__year + , subq_8.ds__extract_year + , subq_8.ds__extract_quarter + , subq_8.ds__extract_month + , subq_8.ds__extract_week + , subq_8.ds__extract_day + , subq_8.ds__extract_dayofweek + , subq_8.ds__extract_dayofyear , subq_8.ds_partitioned__day , subq_8.ds_partitioned__week , subq_8.ds_partitioned__month , subq_8.ds_partitioned__quarter , subq_8.ds_partitioned__year + , subq_8.ds_partitioned__extract_year + , subq_8.ds_partitioned__extract_quarter + , subq_8.ds_partitioned__extract_month + , subq_8.ds_partitioned__extract_week + , subq_8.ds_partitioned__extract_day + , subq_8.ds_partitioned__extract_dayofweek + , subq_8.ds_partitioned__extract_dayofyear , subq_8.paid_at__day , subq_8.paid_at__week , subq_8.paid_at__month , subq_8.paid_at__quarter , subq_8.paid_at__year + , subq_8.paid_at__extract_year + , subq_8.paid_at__extract_quarter + , subq_8.paid_at__extract_month + , subq_8.paid_at__extract_week + , subq_8.paid_at__extract_day + , subq_8.paid_at__extract_dayofweek + , subq_8.paid_at__extract_dayofyear , subq_8.booking__ds__day , subq_8.booking__ds__week , subq_8.booking__ds__month , subq_8.booking__ds__quarter , subq_8.booking__ds__year + , subq_8.booking__ds__extract_year + , subq_8.booking__ds__extract_quarter + , subq_8.booking__ds__extract_month + , subq_8.booking__ds__extract_week + , subq_8.booking__ds__extract_day + , subq_8.booking__ds__extract_dayofweek + , subq_8.booking__ds__extract_dayofyear , subq_8.booking__ds_partitioned__day , subq_8.booking__ds_partitioned__week , subq_8.booking__ds_partitioned__month , subq_8.booking__ds_partitioned__quarter , subq_8.booking__ds_partitioned__year + , subq_8.booking__ds_partitioned__extract_year + , subq_8.booking__ds_partitioned__extract_quarter + , subq_8.booking__ds_partitioned__extract_month + , subq_8.booking__ds_partitioned__extract_week + , subq_8.booking__ds_partitioned__extract_day + , subq_8.booking__ds_partitioned__extract_dayofweek + , subq_8.booking__ds_partitioned__extract_dayofyear , subq_8.booking__paid_at__day , subq_8.booking__paid_at__week , subq_8.booking__paid_at__month , subq_8.booking__paid_at__quarter , subq_8.booking__paid_at__year + , subq_8.booking__paid_at__extract_year + , subq_8.booking__paid_at__extract_quarter + , subq_8.booking__paid_at__extract_month + , subq_8.booking__paid_at__extract_week + , subq_8.booking__paid_at__extract_day + , subq_8.booking__paid_at__extract_dayofweek + , subq_8.booking__paid_at__extract_dayofyear , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month @@ -370,32 +580,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql index edd3eef59c..390f041085 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_4.ds__month AS ds__month , subq_4.ds__quarter AS ds__quarter , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_week AS ds__extract_week + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_4.ds__extract_dayofyear AS ds__extract_dayofyear , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , subq_4.ds_partitioned__year AS ds_partitioned__year + , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_4.paid_at__day AS paid_at__day , subq_4.paid_at__week AS paid_at__week , subq_4.paid_at__month AS paid_at__month , subq_4.paid_at__quarter AS paid_at__quarter , subq_4.paid_at__year AS paid_at__year + , subq_4.paid_at__extract_year AS paid_at__extract_year + , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_4.paid_at__extract_month AS paid_at__extract_month + , subq_4.paid_at__extract_week AS paid_at__extract_week + , subq_4.paid_at__extract_day AS paid_at__extract_day + , subq_4.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_4.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_4.booking__ds__day AS booking__ds__day , subq_4.booking__ds__week AS booking__ds__week , subq_4.booking__ds__month AS booking__ds__month , subq_4.booking__ds__quarter AS booking__ds__quarter , subq_4.booking__ds__year AS booking__ds__year + , subq_4.booking__ds__extract_year AS booking__ds__extract_year + , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_4.booking__ds__extract_month AS booking__ds__extract_month + , subq_4.booking__ds__extract_week AS booking__ds__extract_week + , subq_4.booking__ds__extract_day AS booking__ds__extract_day + , subq_4.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_4.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_4.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_4.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_4.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_4.booking__paid_at__day AS booking__paid_at__day , subq_4.booking__paid_at__week AS booking__paid_at__week , subq_4.booking__paid_at__month AS booking__paid_at__month , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter , subq_4.booking__paid_at__year AS booking__paid_at__year + , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_4.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_4.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_4.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,31 +130,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , 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 @@ -152,31 +236,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -226,32 +352,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql index 26c360ab9e..3c8d87a17b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year + , subq_1.ds__extract_year AS ds__extract_year + , subq_1.ds__extract_quarter AS ds__extract_quarter + , subq_1.ds__extract_month AS ds__extract_month + , subq_1.ds__extract_week AS ds__extract_week + , subq_1.ds__extract_day AS ds__extract_day + , subq_1.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_1.ds__extract_dayofyear AS ds__extract_dayofyear , subq_1.ds_partitioned__day AS ds_partitioned__day , subq_1.ds_partitioned__week AS ds_partitioned__week , subq_1.ds_partitioned__month AS ds_partitioned__month , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter , subq_1.ds_partitioned__year AS ds_partitioned__year + , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_1.paid_at__day AS paid_at__day , subq_1.paid_at__week AS paid_at__week , subq_1.paid_at__month AS paid_at__month , subq_1.paid_at__quarter AS paid_at__quarter , subq_1.paid_at__year AS paid_at__year + , subq_1.paid_at__extract_year AS paid_at__extract_year + , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_1.paid_at__extract_month AS paid_at__extract_month + , subq_1.paid_at__extract_week AS paid_at__extract_week + , subq_1.paid_at__extract_day AS paid_at__extract_day + , subq_1.paid_at__extract_dayofweek AS paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear AS paid_at__extract_dayofyear , subq_1.booking__ds__day AS booking__ds__day , 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_week AS booking__ds__extract_week + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek AS booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear AS booking__ds__extract_dayofyear , 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 , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek AS booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear AS booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day AS booking__paid_at__day , subq_1.booking__paid_at__week AS booking__paid_at__week , subq_1.booking__paid_at__month AS booking__paid_at__month , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter , subq_1.booking__paid_at__year AS booking__paid_at__year + , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek AS booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear AS booking__paid_at__extract_dayofyear , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,31 +129,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -161,32 +245,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql index 870b2c80ea..3adff18e62 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_distinct_values__plan0.sql @@ -42,31 +42,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -116,32 +158,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -166,21 +250,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -209,11 +321,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -222,11 +348,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql index ddba65921c..00efad0383 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql @@ -25,32 +25,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql index 7ce1a71c7f..7e0fdff19e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql index 81e6d39ada..eb70f04221 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -48,31 +48,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -122,32 +164,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -172,21 +256,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -215,11 +327,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -228,11 +354,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql index 4caa3d07f0..ffb3e5111b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0.sql @@ -30,8 +30,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_4.window_start__day AS listing__window_start__day - , subq_4.window_end__day AS listing__window_end__day + , subq_4.window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_4.window_end__extract_quarter AS listing__window_end__extract_quarter , subq_2.listing AS listing , subq_4.capacity AS listing__capacity , subq_2.bookings AS bookings @@ -50,31 +50,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -110,32 +152,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -152,8 +236,8 @@ FROM ( -- Pass Only Elements: -- ['capacity', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_3.window_start__day - , subq_3.window_end__day + subq_3.window_start__extract_dayofweek + , subq_3.window_end__extract_quarter , subq_3.listing , subq_3.capacity FROM ( @@ -164,11 +248,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +275,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -196,12 +308,12 @@ FROM ( subq_2.listing = subq_4.listing ) AND ( ( - subq_2.metric_time__day >= subq_4.window_start__day + subq_2.metric_time__day >= subq_4.window_start__extract_dayofweek ) AND ( ( - subq_2.metric_time__day < subq_4.window_end__day + subq_2.metric_time__day < subq_4.window_end__extract_quarter ) OR ( - subq_4.window_end__day IS NULL + subq_4.window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql index 86a2010b35..476482731c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_scd_dimension__plan0_optimized.sql @@ -32,12 +32,12 @@ FROM ( subq_12.listing = listings_src_10017.listing_id ) AND ( ( - subq_12.metric_time__day >= listings_src_10017.active_from + subq_12.metric_time__day >= EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) ) AND ( ( - subq_12.metric_time__day < listings_src_10017.active_to + subq_12.metric_time__day < EXTRACT(QUARTER FROM listings_src_10017.active_to) ) OR ( - listings_src_10017.active_to IS NULL + EXTRACT(QUARTER FROM listings_src_10017.active_to) IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index 6ed1bd4e99..6ef8853985 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql index 22702f0c48..29fb5d972e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql index 027f20ea5b..16e8afe8d0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql @@ -37,31 +37,73 @@ INNER JOIN ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -111,32 +153,74 @@ INNER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql index 913fed793c..b00d690648 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_limit_rows__plan0.sql @@ -26,31 +26,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql index 86b30c4553..583b4a4bf0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_local_dimension_using_local_entity__plan0.sql @@ -21,21 +21,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.created_at__day , subq_0.created_at__week , subq_0.created_at__month , subq_0.created_at__quarter , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_week + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dayofweek + , subq_0.created_at__extract_dayofyear , subq_0.listing__ds__day , subq_0.listing__ds__week , subq_0.listing__ds__month , subq_0.listing__ds__quarter , subq_0.listing__ds__year + , subq_0.listing__ds__extract_year + , subq_0.listing__ds__extract_quarter + , subq_0.listing__ds__extract_month + , subq_0.listing__ds__extract_week + , subq_0.listing__ds__extract_day + , subq_0.listing__ds__extract_dayofweek + , subq_0.listing__ds__extract_dayofyear , subq_0.listing__created_at__day , subq_0.listing__created_at__week , subq_0.listing__created_at__month , subq_0.listing__created_at__quarter , subq_0.listing__created_at__year + , subq_0.listing__created_at__extract_year + , subq_0.listing__created_at__extract_quarter + , subq_0.listing__created_at__extract_month + , subq_0.listing__created_at__extract_week + , subq_0.listing__created_at__extract_day + , subq_0.listing__created_at__extract_dayofweek + , subq_0.listing__created_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -64,11 +92,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -77,11 +119,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql index 316737d00a..b05da97264 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql @@ -35,32 +35,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql index 73e6a70d92..437dc887b4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint__plan0.sql @@ -60,31 +60,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -134,32 +176,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -184,21 +268,49 @@ FROM ( , subq_3.ds__month , subq_3.ds__quarter , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_week + , subq_3.ds__extract_day + , subq_3.ds__extract_dayofweek + , subq_3.ds__extract_dayofyear , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dayofweek + , subq_3.created_at__extract_dayofyear , subq_3.listing__ds__day , subq_3.listing__ds__week , subq_3.listing__ds__month , subq_3.listing__ds__quarter , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_week + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dayofweek + , subq_3.listing__ds__extract_dayofyear , subq_3.listing__created_at__day , subq_3.listing__created_at__week , subq_3.listing__created_at__month , subq_3.listing__created_at__quarter , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_week + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dayofweek + , subq_3.listing__created_at__extract_dayofyear , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month @@ -227,11 +339,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -240,11 +366,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -317,31 +457,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -391,32 +573,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -441,21 +665,49 @@ FROM ( , subq_15.ds__month , subq_15.ds__quarter , subq_15.ds__year + , subq_15.ds__extract_year + , subq_15.ds__extract_quarter + , subq_15.ds__extract_month + , subq_15.ds__extract_week + , subq_15.ds__extract_day + , subq_15.ds__extract_dayofweek + , subq_15.ds__extract_dayofyear , subq_15.created_at__day , subq_15.created_at__week , subq_15.created_at__month , subq_15.created_at__quarter , subq_15.created_at__year + , subq_15.created_at__extract_year + , subq_15.created_at__extract_quarter + , subq_15.created_at__extract_month + , subq_15.created_at__extract_week + , subq_15.created_at__extract_day + , subq_15.created_at__extract_dayofweek + , subq_15.created_at__extract_dayofyear , subq_15.listing__ds__day , subq_15.listing__ds__week , subq_15.listing__ds__month , subq_15.listing__ds__quarter , subq_15.listing__ds__year + , subq_15.listing__ds__extract_year + , subq_15.listing__ds__extract_quarter + , subq_15.listing__ds__extract_month + , subq_15.listing__ds__extract_week + , subq_15.listing__ds__extract_day + , subq_15.listing__ds__extract_dayofweek + , subq_15.listing__ds__extract_dayofyear , subq_15.listing__created_at__day , subq_15.listing__created_at__week , subq_15.listing__created_at__month , subq_15.listing__created_at__quarter , subq_15.listing__created_at__year + , subq_15.listing__created_at__extract_year + , subq_15.listing__created_at__extract_quarter + , subq_15.listing__created_at__extract_month + , subq_15.listing__created_at__extract_week + , subq_15.listing__created_at__extract_day + , subq_15.listing__created_at__extract_dayofweek + , subq_15.listing__created_at__extract_dayofyear , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month @@ -484,11 +736,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -497,11 +763,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -557,31 +837,73 @@ FROM ( , subq_24.ds__month , subq_24.ds__quarter , subq_24.ds__year + , subq_24.ds__extract_year + , subq_24.ds__extract_quarter + , subq_24.ds__extract_month + , subq_24.ds__extract_week + , subq_24.ds__extract_day + , subq_24.ds__extract_dayofweek + , subq_24.ds__extract_dayofyear , subq_24.ds_partitioned__day , subq_24.ds_partitioned__week , subq_24.ds_partitioned__month , subq_24.ds_partitioned__quarter , subq_24.ds_partitioned__year + , subq_24.ds_partitioned__extract_year + , subq_24.ds_partitioned__extract_quarter + , subq_24.ds_partitioned__extract_month + , subq_24.ds_partitioned__extract_week + , subq_24.ds_partitioned__extract_day + , subq_24.ds_partitioned__extract_dayofweek + , subq_24.ds_partitioned__extract_dayofyear , subq_24.paid_at__day , subq_24.paid_at__week , subq_24.paid_at__month , subq_24.paid_at__quarter , subq_24.paid_at__year + , subq_24.paid_at__extract_year + , subq_24.paid_at__extract_quarter + , subq_24.paid_at__extract_month + , subq_24.paid_at__extract_week + , subq_24.paid_at__extract_day + , subq_24.paid_at__extract_dayofweek + , subq_24.paid_at__extract_dayofyear , subq_24.booking__ds__day , subq_24.booking__ds__week , subq_24.booking__ds__month , subq_24.booking__ds__quarter , subq_24.booking__ds__year + , subq_24.booking__ds__extract_year + , subq_24.booking__ds__extract_quarter + , subq_24.booking__ds__extract_month + , subq_24.booking__ds__extract_week + , subq_24.booking__ds__extract_day + , subq_24.booking__ds__extract_dayofweek + , subq_24.booking__ds__extract_dayofyear , subq_24.booking__ds_partitioned__day , subq_24.booking__ds_partitioned__week , subq_24.booking__ds_partitioned__month , subq_24.booking__ds_partitioned__quarter , subq_24.booking__ds_partitioned__year + , subq_24.booking__ds_partitioned__extract_year + , subq_24.booking__ds_partitioned__extract_quarter + , subq_24.booking__ds_partitioned__extract_month + , subq_24.booking__ds_partitioned__extract_week + , subq_24.booking__ds_partitioned__extract_day + , subq_24.booking__ds_partitioned__extract_dayofweek + , subq_24.booking__ds_partitioned__extract_dayofyear , subq_24.booking__paid_at__day , subq_24.booking__paid_at__week , subq_24.booking__paid_at__month , subq_24.booking__paid_at__quarter , subq_24.booking__paid_at__year + , subq_24.booking__paid_at__extract_year + , subq_24.booking__paid_at__extract_quarter + , subq_24.booking__paid_at__extract_month + , subq_24.booking__paid_at__extract_week + , subq_24.booking__paid_at__extract_day + , subq_24.booking__paid_at__extract_dayofweek + , subq_24.booking__paid_at__extract_dayofyear , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month @@ -631,32 +953,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql index 4176ca90e9..37ad3a608e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0.sql @@ -45,31 +45,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -119,32 +161,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -186,31 +270,73 @@ FROM ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.ds_partitioned__day , subq_7.ds_partitioned__week , subq_7.ds_partitioned__month , subq_7.ds_partitioned__quarter , subq_7.ds_partitioned__year + , subq_7.ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_week + , subq_7.ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dayofweek + , subq_7.ds_partitioned__extract_dayofyear , subq_7.paid_at__day , subq_7.paid_at__week , subq_7.paid_at__month , subq_7.paid_at__quarter , subq_7.paid_at__year + , subq_7.paid_at__extract_year + , subq_7.paid_at__extract_quarter + , subq_7.paid_at__extract_month + , subq_7.paid_at__extract_week + , subq_7.paid_at__extract_day + , subq_7.paid_at__extract_dayofweek + , subq_7.paid_at__extract_dayofyear , subq_7.booking__ds__day , subq_7.booking__ds__week , subq_7.booking__ds__month , subq_7.booking__ds__quarter , subq_7.booking__ds__year + , subq_7.booking__ds__extract_year + , subq_7.booking__ds__extract_quarter + , subq_7.booking__ds__extract_month + , subq_7.booking__ds__extract_week + , subq_7.booking__ds__extract_day + , subq_7.booking__ds__extract_dayofweek + , subq_7.booking__ds__extract_dayofyear , subq_7.booking__ds_partitioned__day , subq_7.booking__ds_partitioned__week , subq_7.booking__ds_partitioned__month , subq_7.booking__ds_partitioned__quarter , subq_7.booking__ds_partitioned__year + , subq_7.booking__ds_partitioned__extract_year + , subq_7.booking__ds_partitioned__extract_quarter + , subq_7.booking__ds_partitioned__extract_month + , subq_7.booking__ds_partitioned__extract_week + , subq_7.booking__ds_partitioned__extract_day + , subq_7.booking__ds_partitioned__extract_dayofweek + , subq_7.booking__ds_partitioned__extract_dayofyear , subq_7.booking__paid_at__day , subq_7.booking__paid_at__week , subq_7.booking__paid_at__month , subq_7.booking__paid_at__quarter , subq_7.booking__paid_at__year + , subq_7.booking__paid_at__extract_year + , subq_7.booking__paid_at__extract_quarter + , subq_7.booking__paid_at__extract_month + , subq_7.booking__paid_at__extract_week + , subq_7.booking__paid_at__extract_day + , subq_7.booking__paid_at__extract_dayofweek + , subq_7.booking__paid_at__extract_dayofyear , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month @@ -260,32 +386,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 13d80a91d0..a495423238 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -39,31 +39,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -113,32 +155,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index 14ec230f17..0e4cdb1a6a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -160,21 +244,49 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.created_at__day , subq_5.created_at__week , subq_5.created_at__month , subq_5.created_at__quarter , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_week + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dayofweek + , subq_5.created_at__extract_dayofyear , subq_5.listing__ds__day , subq_5.listing__ds__week , subq_5.listing__ds__month , subq_5.listing__ds__quarter , subq_5.listing__ds__year + , subq_5.listing__ds__extract_year + , subq_5.listing__ds__extract_quarter + , subq_5.listing__ds__extract_month + , subq_5.listing__ds__extract_week + , subq_5.listing__ds__extract_day + , subq_5.listing__ds__extract_dayofweek + , subq_5.listing__ds__extract_dayofyear , subq_5.listing__created_at__day , subq_5.listing__created_at__week , subq_5.listing__created_at__month , subq_5.listing__created_at__quarter , subq_5.listing__created_at__year + , subq_5.listing__created_at__extract_year + , subq_5.listing__created_at__extract_quarter + , subq_5.listing__created_at__extract_month + , subq_5.listing__created_at__extract_week + , subq_5.listing__created_at__extract_day + , subq_5.listing__created_at__extract_dayofweek + , subq_5.listing__created_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -203,11 +315,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -216,11 +342,25 @@ FROM ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql index 88cc0b431d..ea7d4a7649 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql @@ -20,8 +20,8 @@ FROM ( -- Join Standard Outputs SELECT subq_2.metric_time__day AS metric_time__day - , subq_7.window_start__day AS listing__window_start__day - , subq_7.window_end__day AS listing__window_end__day + , subq_7.window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_7.window_end__extract_quarter AS listing__window_end__extract_quarter , subq_2.listing AS listing , subq_7.user__home_state_latest AS listing__user__home_state_latest , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -142,8 +226,8 @@ FROM ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - subq_6.window_start__day - , subq_6.window_end__day + subq_6.window_start__extract_dayofweek + , subq_6.window_end__extract_quarter , subq_6.listing , subq_6.user__home_state_latest FROM ( @@ -154,26 +238,61 @@ FROM ( , subq_3.window_start__month AS window_start__month , subq_3.window_start__quarter AS window_start__quarter , subq_3.window_start__year AS window_start__year + , subq_3.window_start__extract_year AS window_start__extract_year + , subq_3.window_start__extract_quarter AS window_start__extract_quarter + , subq_3.window_start__extract_month AS window_start__extract_month + , subq_3.window_start__extract_week AS window_start__extract_week + , subq_3.window_start__extract_day AS window_start__extract_day + , subq_3.window_start__extract_dayofweek AS window_start__extract_dayofweek + , subq_3.window_start__extract_dayofyear AS window_start__extract_dayofyear , subq_3.window_end__day AS window_end__day , subq_3.window_end__week AS window_end__week , subq_3.window_end__month AS window_end__month , subq_3.window_end__quarter AS window_end__quarter , subq_3.window_end__year AS window_end__year + , subq_3.window_end__extract_year AS window_end__extract_year + , subq_3.window_end__extract_quarter AS window_end__extract_quarter + , subq_3.window_end__extract_month AS window_end__extract_month + , subq_3.window_end__extract_week AS window_end__extract_week + , subq_3.window_end__extract_day AS window_end__extract_day + , subq_3.window_end__extract_dayofweek AS window_end__extract_dayofweek + , subq_3.window_end__extract_dayofyear AS window_end__extract_dayofyear , subq_3.listing__window_start__day AS listing__window_start__day , subq_3.listing__window_start__week AS listing__window_start__week , subq_3.listing__window_start__month AS listing__window_start__month , subq_3.listing__window_start__quarter AS listing__window_start__quarter , subq_3.listing__window_start__year AS listing__window_start__year + , subq_3.listing__window_start__extract_year AS listing__window_start__extract_year + , subq_3.listing__window_start__extract_quarter AS listing__window_start__extract_quarter + , subq_3.listing__window_start__extract_month AS listing__window_start__extract_month + , subq_3.listing__window_start__extract_week AS listing__window_start__extract_week + , subq_3.listing__window_start__extract_day AS listing__window_start__extract_day + , subq_3.listing__window_start__extract_dayofweek AS listing__window_start__extract_dayofweek + , subq_3.listing__window_start__extract_dayofyear AS listing__window_start__extract_dayofyear , subq_3.listing__window_end__day AS listing__window_end__day , subq_3.listing__window_end__week AS listing__window_end__week , subq_3.listing__window_end__month AS listing__window_end__month , subq_3.listing__window_end__quarter AS listing__window_end__quarter , subq_3.listing__window_end__year AS listing__window_end__year + , subq_3.listing__window_end__extract_year AS listing__window_end__extract_year + , subq_3.listing__window_end__extract_quarter AS listing__window_end__extract_quarter + , subq_3.listing__window_end__extract_month AS listing__window_end__extract_month + , subq_3.listing__window_end__extract_week AS listing__window_end__extract_week + , subq_3.listing__window_end__extract_day AS listing__window_end__extract_day + , subq_3.listing__window_end__extract_dayofweek AS listing__window_end__extract_dayofweek + , subq_3.listing__window_end__extract_dayofyear AS listing__window_end__extract_dayofyear , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dayofweek AS user__ds__extract_dayofweek + , subq_5.ds__extract_dayofyear AS user__ds__extract_dayofyear , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +311,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_dayofyear , listings_src_10017.active_to AS window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_dayofyear , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +338,25 @@ FROM ( , DATE_TRUNC('month', listings_src_10017.active_from) AS listing__window_start__month , DATE_TRUNC('quarter', listings_src_10017.active_from) AS listing__window_start__quarter , DATE_TRUNC('year', listings_src_10017.active_from) AS listing__window_start__year + , EXTRACT(YEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_from) AS listing__window_start__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_from) AS listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_dayofyear , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC('week', listings_src_10017.active_to) AS listing__window_end__week , DATE_TRUNC('month', listings_src_10017.active_to) AS listing__window_end__month , DATE_TRUNC('quarter', listings_src_10017.active_to) AS listing__window_end__quarter , DATE_TRUNC('year', listings_src_10017.active_to) AS listing__window_end__year + , EXTRACT(YEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_year + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter + , EXTRACT(MONTH FROM listings_src_10017.active_to) AS listing__window_end__extract_month + , EXTRACT(WEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(DAY FROM listings_src_10017.active_to) AS listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_dayofyear , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -227,11 +374,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', + -- 'ds__day', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', + -- 'user__ds__day', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +400,25 @@ FROM ( , subq_4.ds__month , subq_4.ds__quarter , subq_4.ds__year + , subq_4.ds__extract_year + , subq_4.ds__extract_quarter + , subq_4.ds__extract_month + , subq_4.ds__extract_week + , subq_4.ds__extract_day + , subq_4.ds__extract_dayofweek + , subq_4.ds__extract_dayofyear , subq_4.user__ds__day , subq_4.user__ds__week , subq_4.user__ds__month , subq_4.user__ds__quarter , subq_4.user__ds__year + , subq_4.user__ds__extract_year + , subq_4.user__ds__extract_quarter + , subq_4.user__ds__extract_month + , subq_4.user__ds__extract_week + , subq_4.user__ds__extract_day + , subq_4.user__ds__extract_dayofweek + , subq_4.user__ds__extract_dayofyear , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +430,26 @@ FROM ( , DATE_TRUNC('month', users_latest_src_10021.ds) AS ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS ds__extract_dayofyear , users_latest_src_10021.home_state_latest , users_latest_src_10021.ds AS user__ds__day , DATE_TRUNC('week', users_latest_src_10021.ds) AS user__ds__week , DATE_TRUNC('month', users_latest_src_10021.ds) AS user__ds__month , DATE_TRUNC('quarter', users_latest_src_10021.ds) AS user__ds__quarter , DATE_TRUNC('year', users_latest_src_10021.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_latest_src_10021.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_latest_src_10021.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_latest_src_10021.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_latest_src_10021.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_latest_src_10021.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS user__ds__extract_dayofyear , users_latest_src_10021.home_state_latest AS user__home_state_latest , users_latest_src_10021.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10021 @@ -275,12 +464,12 @@ FROM ( subq_2.listing = subq_7.listing ) AND ( ( - subq_2.metric_time__day >= subq_7.window_start__day + subq_2.metric_time__day >= subq_7.window_start__extract_dayofweek ) AND ( ( - subq_2.metric_time__day < subq_7.window_end__day + subq_2.metric_time__day < subq_7.window_end__extract_quarter ) OR ( - subq_7.window_end__day IS NULL + subq_7.window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql index feb5ed0fdc..603c0686e8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0_optimized.sql @@ -23,8 +23,8 @@ LEFT OUTER JOIN ( -- Pass Only Elements: -- ['user__home_state_latest', 'window_start__day', 'window_end__day', 'listing'] SELECT - listings_src_10017.active_from AS window_start__day - , listings_src_10017.active_to AS window_end__day + EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dayofweek + , EXTRACT(QUARTER FROM listings_src_10017.active_to) AS window_end__extract_quarter , listings_src_10017.listing_id AS listing , users_latest_src_10021.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings listings_src_10017 @@ -38,12 +38,12 @@ ON subq_13.listing = subq_18.listing ) AND ( ( - subq_13.metric_time__day >= subq_18.window_start__day + subq_13.metric_time__day >= subq_18.window_start__extract_dayofweek ) AND ( ( - subq_13.metric_time__day < subq_18.window_end__day + subq_13.metric_time__day < subq_18.window_end__extract_quarter ) OR ( - subq_18.window_end__day IS NULL + subq_18.window_end__extract_quarter IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql index 94054a124c..f5dafcb635 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql @@ -21,7 +21,7 @@ FROM ( SELECT subq_2.metric_time__day AS metric_time__day , subq_7.lux_listing__window_start__day AS listing__lux_listing__window_start__day - , subq_7.lux_listing__window_end__day AS listing__lux_listing__window_end__day + , subq_7.lux_listing__window_end__extract_month AS listing__lux_listing__window_end__extract_month , subq_2.listing AS listing , subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_2.bookings AS bookings @@ -40,31 +40,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -100,32 +142,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10015.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10015.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10015.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10015.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10015.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10015.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10015.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -146,7 +230,7 @@ FROM ( -- 'listing'] SELECT subq_6.lux_listing__window_start__day - , subq_6.lux_listing__window_end__day + , subq_6.lux_listing__window_end__extract_month , subq_6.listing , subq_6.lux_listing__is_confirmed_lux FROM ( @@ -157,11 +241,25 @@ FROM ( , subq_5.window_start__month AS lux_listing__window_start__month , subq_5.window_start__quarter AS lux_listing__window_start__quarter , subq_5.window_start__year AS lux_listing__window_start__year + , subq_5.window_start__extract_year AS lux_listing__window_start__extract_year + , subq_5.window_start__extract_quarter AS lux_listing__window_start__extract_quarter + , subq_5.window_start__extract_month AS lux_listing__window_start__extract_month + , subq_5.window_start__extract_week AS lux_listing__window_start__extract_week + , subq_5.window_start__extract_day AS lux_listing__window_start__extract_day + , subq_5.window_start__extract_dayofweek AS lux_listing__window_start__extract_dayofweek + , subq_5.window_start__extract_dayofyear AS lux_listing__window_start__extract_dayofyear , subq_5.window_end__day AS lux_listing__window_end__day , subq_5.window_end__week AS lux_listing__window_end__week , subq_5.window_end__month AS lux_listing__window_end__month , subq_5.window_end__quarter AS lux_listing__window_end__quarter , subq_5.window_end__year AS lux_listing__window_end__year + , subq_5.window_end__extract_year AS lux_listing__window_end__extract_year + , subq_5.window_end__extract_quarter AS lux_listing__window_end__extract_quarter + , subq_5.window_end__extract_month AS lux_listing__window_end__extract_month + , subq_5.window_end__extract_week AS lux_listing__window_end__extract_week + , subq_5.window_end__extract_day AS lux_listing__window_end__extract_day + , subq_5.window_end__extract_dayofweek AS lux_listing__window_end__extract_dayofweek + , subq_5.window_end__extract_dayofyear AS lux_listing__window_end__extract_dayofyear , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +281,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', + -- 'window_start__day', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', + -- 'window_end__day', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__day', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__day', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +331,49 @@ FROM ( , subq_4.window_start__month , subq_4.window_start__quarter , subq_4.window_start__year + , subq_4.window_start__extract_year + , subq_4.window_start__extract_quarter + , subq_4.window_start__extract_month + , subq_4.window_start__extract_week + , subq_4.window_start__extract_day + , subq_4.window_start__extract_dayofweek + , subq_4.window_start__extract_dayofyear , subq_4.window_end__day , subq_4.window_end__week , subq_4.window_end__month , subq_4.window_end__quarter , subq_4.window_end__year + , subq_4.window_end__extract_year + , subq_4.window_end__extract_quarter + , subq_4.window_end__extract_month + , subq_4.window_end__extract_week + , subq_4.window_end__extract_day + , subq_4.window_end__extract_dayofweek + , subq_4.window_end__extract_dayofyear , subq_4.lux_listing__window_start__day , subq_4.lux_listing__window_start__week , subq_4.lux_listing__window_start__month , subq_4.lux_listing__window_start__quarter , subq_4.lux_listing__window_start__year + , subq_4.lux_listing__window_start__extract_year + , subq_4.lux_listing__window_start__extract_quarter + , subq_4.lux_listing__window_start__extract_month + , subq_4.lux_listing__window_start__extract_week + , subq_4.lux_listing__window_start__extract_day + , subq_4.lux_listing__window_start__extract_dayofweek + , subq_4.lux_listing__window_start__extract_dayofyear , subq_4.lux_listing__window_end__day , subq_4.lux_listing__window_end__week , subq_4.lux_listing__window_end__month , subq_4.lux_listing__window_end__quarter , subq_4.lux_listing__window_end__year + , subq_4.lux_listing__window_end__extract_year + , subq_4.lux_listing__window_end__extract_quarter + , subq_4.lux_listing__window_end__extract_month + , subq_4.lux_listing__window_end__extract_week + , subq_4.lux_listing__window_end__extract_day + , subq_4.lux_listing__window_end__extract_dayofweek + , subq_4.lux_listing__window_end__extract_dayofyear , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +385,50 @@ FROM ( , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux , lux_listings_src_10019.valid_from AS lux_listing__window_start__day , DATE_TRUNC('week', lux_listings_src_10019.valid_from) AS lux_listing__window_start__week , DATE_TRUNC('month', lux_listings_src_10019.valid_from) AS lux_listing__window_start__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_from) AS lux_listing__window_start__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_from) AS lux_listing__window_start__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dayofyear , lux_listings_src_10019.valid_to AS lux_listing__window_end__day , DATE_TRUNC('week', lux_listings_src_10019.valid_to) AS lux_listing__window_end__week , DATE_TRUNC('month', lux_listings_src_10019.valid_to) AS lux_listing__window_end__month , DATE_TRUNC('quarter', lux_listings_src_10019.valid_to) AS lux_listing__window_end__quarter , DATE_TRUNC('year', lux_listings_src_10019.valid_to) AS lux_listing__window_end__year + , EXTRACT(YEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year + , EXTRACT(QUARTER FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month + , EXTRACT(WEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week + , EXTRACT(DAY FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_day + , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dayofyear , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux , lux_listings_src_10019.lux_listing_id AS lux_listing FROM ***************************.dim_lux_listings lux_listings_src_10019 @@ -264,9 +446,9 @@ FROM ( subq_2.metric_time__day >= subq_7.lux_listing__window_start__day ) AND ( ( - subq_2.metric_time__day < subq_7.lux_listing__window_end__day + subq_2.metric_time__day < subq_7.lux_listing__window_end__extract_month ) OR ( - subq_7.lux_listing__window_end__day IS NULL + subq_7.lux_listing__window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql index f1b419a284..6c22196f78 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0_optimized.sql @@ -27,7 +27,7 @@ LEFT OUTER JOIN ( -- 'listing'] SELECT lux_listings_src_10019.valid_from AS lux_listing__window_start__day - , lux_listings_src_10019.valid_to AS lux_listing__window_end__day + , EXTRACT(MONTH FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month , lux_listing_mapping_src_10018.listing_id AS listing , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_10018 @@ -44,9 +44,9 @@ ON subq_13.metric_time__day >= subq_18.lux_listing__window_start__day ) AND ( ( - subq_13.metric_time__day < subq_18.lux_listing__window_end__day + subq_13.metric_time__day < subq_18.lux_listing__window_end__extract_month ) OR ( - subq_18.lux_listing__window_end__day IS NULL + subq_18.lux_listing__window_end__extract_month IS NULL ) ) ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql index ae8b7838b7..cb9670f074 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql @@ -33,32 +33,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -85,11 +127,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -98,11 +154,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -131,11 +201,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -144,11 +228,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql index d35179ebf0..fbddd59f54 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.ds__day , subq_0.ds__week , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.account_id__ds_partitioned__day , subq_0.account_id__ds_partitioned__week , subq_0.account_id__ds_partitioned__month , subq_0.account_id__ds_partitioned__quarter , subq_0.account_id__ds_partitioned__year + , subq_0.account_id__ds_partitioned__extract_year + , subq_0.account_id__ds_partitioned__extract_quarter + , subq_0.account_id__ds_partitioned__extract_month + , subq_0.account_id__ds_partitioned__extract_week + , subq_0.account_id__ds_partitioned__extract_day + , subq_0.account_id__ds_partitioned__extract_dayofweek + , subq_0.account_id__ds_partitioned__extract_dayofyear , subq_0.account_id__ds__day , subq_0.account_id__ds__week , subq_0.account_id__ds__month , subq_0.account_id__ds__quarter , subq_0.account_id__ds__year + , subq_0.account_id__ds__extract_year + , subq_0.account_id__ds__extract_quarter + , subq_0.account_id__ds__extract_month + , subq_0.account_id__ds__extract_week + , subq_0.account_id__ds__extract_day + , subq_0.account_id__ds__extract_dayofweek + , subq_0.account_id__ds__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -69,22 +97,50 @@ FROM ( , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS ds__extract_dayofyear , account_month_txns_src_10010.account_month , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , account_month_txns_src_10010.ds AS account_id__ds__day , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS account_id__ds__week , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS account_id__ds__month , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS account_id__ds__quarter , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS account_id__ds__year + , EXTRACT(YEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_year + , EXTRACT(QUARTER FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_quarter + , EXTRACT(MONTH FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_month + , EXTRACT(WEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week + , EXTRACT(DAY FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_day + , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dayofyear , account_month_txns_src_10010.account_month AS account_id__account_month , account_month_txns_src_10010.account_id FROM ***************************.account_month_txns account_month_txns_src_10010 @@ -106,16 +162,37 @@ FROM ( , subq_3.ds_partitioned__month AS ds_partitioned__month , subq_3.ds_partitioned__quarter AS ds_partitioned__quarter , subq_3.ds_partitioned__year AS ds_partitioned__year + , subq_3.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_3.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dayofweek AS ds_partitioned__extract_dayofweek + , subq_3.ds_partitioned__extract_dayofyear AS ds_partitioned__extract_dayofyear , subq_3.account_id__ds_partitioned__day AS account_id__ds_partitioned__day , subq_3.account_id__ds_partitioned__week AS account_id__ds_partitioned__week , subq_3.account_id__ds_partitioned__month AS account_id__ds_partitioned__month , subq_3.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter , subq_3.account_id__ds_partitioned__year AS account_id__ds_partitioned__year + , subq_3.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year + , subq_3.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter + , subq_3.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month + , subq_3.account_id__ds_partitioned__extract_week AS account_id__ds_partitioned__extract_week + , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day + , subq_3.account_id__ds_partitioned__extract_dayofweek AS account_id__ds_partitioned__extract_dayofweek + , subq_3.account_id__ds_partitioned__extract_dayofyear AS account_id__ds_partitioned__extract_dayofyear , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month , subq_5.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter , subq_5.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_5.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week AS customer_id__ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek AS customer_id__ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear AS customer_id__ds_partitioned__extract_dayofyear , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id @@ -132,12 +209,26 @@ FROM ( , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dayofyear , bridge_table_src_10011.extra_dim AS account_id__extra_dim , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__week , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__month , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__quarter , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__year + , EXTRACT(YEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dayofyear , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id @@ -154,11 +245,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', + -- 'ds_partitioned__day', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__day', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +271,25 @@ FROM ( , subq_4.ds_partitioned__month , subq_4.ds_partitioned__quarter , subq_4.ds_partitioned__year + , subq_4.ds_partitioned__extract_year + , subq_4.ds_partitioned__extract_quarter + , subq_4.ds_partitioned__extract_month + , subq_4.ds_partitioned__extract_week + , subq_4.ds_partitioned__extract_day + , subq_4.ds_partitioned__extract_dayofweek + , subq_4.ds_partitioned__extract_dayofyear , subq_4.customer_id__ds_partitioned__day , subq_4.customer_id__ds_partitioned__week , subq_4.customer_id__ds_partitioned__month , subq_4.customer_id__ds_partitioned__quarter , subq_4.customer_id__ds_partitioned__year + , subq_4.customer_id__ds_partitioned__extract_year + , subq_4.customer_id__ds_partitioned__extract_quarter + , subq_4.customer_id__ds_partitioned__extract_month + , subq_4.customer_id__ds_partitioned__extract_week + , subq_4.customer_id__ds_partitioned__extract_day + , subq_4.customer_id__ds_partitioned__extract_dayofweek + , subq_4.customer_id__ds_partitioned__extract_dayofyear , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +305,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_name AS customer_id__customer_name , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned__day @@ -193,6 +319,13 @@ FROM ( , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__month , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__quarter , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__year + , EXTRACT(YEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_month + , EXTRACT(WEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week + , EXTRACT(DAY FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dayofyear , customer_table_src_10013.customer_id FROM ***************************.customer_table customer_table_src_10013 ) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql index 5c9089deaf..eb31a4fb3a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multiple_metrics_no_dimensions__plan0.sql @@ -23,31 +23,73 @@ FROM ( , subq_1.ds__month , subq_1.ds__quarter , subq_1.ds__year + , subq_1.ds__extract_year + , subq_1.ds__extract_quarter + , subq_1.ds__extract_month + , subq_1.ds__extract_week + , subq_1.ds__extract_day + , subq_1.ds__extract_dayofweek + , subq_1.ds__extract_dayofyear , subq_1.ds_partitioned__day , subq_1.ds_partitioned__week , subq_1.ds_partitioned__month , subq_1.ds_partitioned__quarter , subq_1.ds_partitioned__year + , subq_1.ds_partitioned__extract_year + , subq_1.ds_partitioned__extract_quarter + , subq_1.ds_partitioned__extract_month + , subq_1.ds_partitioned__extract_week + , subq_1.ds_partitioned__extract_day + , subq_1.ds_partitioned__extract_dayofweek + , subq_1.ds_partitioned__extract_dayofyear , subq_1.paid_at__day , subq_1.paid_at__week , subq_1.paid_at__month , subq_1.paid_at__quarter , subq_1.paid_at__year + , subq_1.paid_at__extract_year + , subq_1.paid_at__extract_quarter + , subq_1.paid_at__extract_month + , subq_1.paid_at__extract_week + , subq_1.paid_at__extract_day + , subq_1.paid_at__extract_dayofweek + , subq_1.paid_at__extract_dayofyear , subq_1.booking__ds__day , subq_1.booking__ds__week , subq_1.booking__ds__month , subq_1.booking__ds__quarter , subq_1.booking__ds__year + , subq_1.booking__ds__extract_year + , subq_1.booking__ds__extract_quarter + , subq_1.booking__ds__extract_month + , subq_1.booking__ds__extract_week + , subq_1.booking__ds__extract_day + , subq_1.booking__ds__extract_dayofweek + , subq_1.booking__ds__extract_dayofyear , subq_1.booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month , subq_1.booking__ds_partitioned__quarter , subq_1.booking__ds_partitioned__year + , subq_1.booking__ds_partitioned__extract_year + , subq_1.booking__ds_partitioned__extract_quarter + , subq_1.booking__ds_partitioned__extract_month + , subq_1.booking__ds_partitioned__extract_week + , subq_1.booking__ds_partitioned__extract_day + , subq_1.booking__ds_partitioned__extract_dayofweek + , subq_1.booking__ds_partitioned__extract_dayofyear , subq_1.booking__paid_at__day , subq_1.booking__paid_at__week , subq_1.booking__paid_at__month , subq_1.booking__paid_at__quarter , subq_1.booking__paid_at__year + , subq_1.booking__paid_at__extract_year + , subq_1.booking__paid_at__extract_quarter + , subq_1.booking__paid_at__extract_month + , subq_1.booking__paid_at__extract_week + , subq_1.booking__paid_at__extract_day + , subq_1.booking__paid_at__extract_dayofweek + , subq_1.booking__paid_at__extract_dayofyear , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month @@ -82,31 +124,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -156,32 +240,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -217,21 +343,49 @@ CROSS JOIN ( , subq_7.ds__month , subq_7.ds__quarter , subq_7.ds__year + , subq_7.ds__extract_year + , subq_7.ds__extract_quarter + , subq_7.ds__extract_month + , subq_7.ds__extract_week + , subq_7.ds__extract_day + , subq_7.ds__extract_dayofweek + , subq_7.ds__extract_dayofyear , subq_7.created_at__day , subq_7.created_at__week , subq_7.created_at__month , subq_7.created_at__quarter , subq_7.created_at__year + , subq_7.created_at__extract_year + , subq_7.created_at__extract_quarter + , subq_7.created_at__extract_month + , subq_7.created_at__extract_week + , subq_7.created_at__extract_day + , subq_7.created_at__extract_dayofweek + , subq_7.created_at__extract_dayofyear , subq_7.listing__ds__day , subq_7.listing__ds__week , subq_7.listing__ds__month , subq_7.listing__ds__quarter , subq_7.listing__ds__year + , subq_7.listing__ds__extract_year + , subq_7.listing__ds__extract_quarter + , subq_7.listing__ds__extract_month + , subq_7.listing__ds__extract_week + , subq_7.listing__ds__extract_day + , subq_7.listing__ds__extract_dayofweek + , subq_7.listing__ds__extract_dayofyear , subq_7.listing__created_at__day , subq_7.listing__created_at__week , subq_7.listing__created_at__month , subq_7.listing__created_at__quarter , subq_7.listing__created_at__year + , subq_7.listing__created_at__extract_year + , subq_7.listing__created_at__extract_quarter + , subq_7.listing__created_at__extract_month + , subq_7.listing__created_at__extract_week + , subq_7.listing__created_at__extract_day + , subq_7.listing__created_at__extract_dayofweek + , subq_7.listing__created_at__extract_dayofyear , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month @@ -257,21 +411,49 @@ CROSS JOIN ( , subq_6.ds__month , subq_6.ds__quarter , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_week + , subq_6.ds__extract_day + , subq_6.ds__extract_dayofweek + , subq_6.ds__extract_dayofyear , subq_6.created_at__day , subq_6.created_at__week , subq_6.created_at__month , subq_6.created_at__quarter , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_week + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dayofweek + , subq_6.created_at__extract_dayofyear , subq_6.listing__ds__day , subq_6.listing__ds__week , subq_6.listing__ds__month , subq_6.listing__ds__quarter , subq_6.listing__ds__year + , subq_6.listing__ds__extract_year + , subq_6.listing__ds__extract_quarter + , subq_6.listing__ds__extract_month + , subq_6.listing__ds__extract_week + , subq_6.listing__ds__extract_day + , subq_6.listing__ds__extract_dayofweek + , subq_6.listing__ds__extract_dayofyear , subq_6.listing__created_at__day , subq_6.listing__created_at__week , subq_6.listing__created_at__month , subq_6.listing__created_at__quarter , subq_6.listing__created_at__year + , subq_6.listing__created_at__extract_year + , subq_6.listing__created_at__extract_quarter + , subq_6.listing__created_at__extract_month + , subq_6.listing__created_at__extract_week + , subq_6.listing__created_at__extract_day + , subq_6.listing__created_at__extract_dayofweek + , subq_6.listing__created_at__extract_dayofyear , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month @@ -300,11 +482,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -313,11 +509,25 @@ CROSS JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql index 14a9f0385a..dc0afd0f09 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_nested_derived_metric__plan0.sql @@ -44,31 +44,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -118,32 +160,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -182,31 +266,73 @@ FROM ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month @@ -256,32 +382,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -332,31 +500,73 @@ FROM ( , subq_12.ds__month , subq_12.ds__quarter , subq_12.ds__year + , subq_12.ds__extract_year + , subq_12.ds__extract_quarter + , subq_12.ds__extract_month + , subq_12.ds__extract_week + , subq_12.ds__extract_day + , subq_12.ds__extract_dayofweek + , subq_12.ds__extract_dayofyear , subq_12.ds_partitioned__day , subq_12.ds_partitioned__week , subq_12.ds_partitioned__month , subq_12.ds_partitioned__quarter , subq_12.ds_partitioned__year + , subq_12.ds_partitioned__extract_year + , subq_12.ds_partitioned__extract_quarter + , subq_12.ds_partitioned__extract_month + , subq_12.ds_partitioned__extract_week + , subq_12.ds_partitioned__extract_day + , subq_12.ds_partitioned__extract_dayofweek + , subq_12.ds_partitioned__extract_dayofyear , subq_12.paid_at__day , subq_12.paid_at__week , subq_12.paid_at__month , subq_12.paid_at__quarter , subq_12.paid_at__year + , subq_12.paid_at__extract_year + , subq_12.paid_at__extract_quarter + , subq_12.paid_at__extract_month + , subq_12.paid_at__extract_week + , subq_12.paid_at__extract_day + , subq_12.paid_at__extract_dayofweek + , subq_12.paid_at__extract_dayofyear , subq_12.booking__ds__day , subq_12.booking__ds__week , subq_12.booking__ds__month , subq_12.booking__ds__quarter , subq_12.booking__ds__year + , subq_12.booking__ds__extract_year + , subq_12.booking__ds__extract_quarter + , subq_12.booking__ds__extract_month + , subq_12.booking__ds__extract_week + , subq_12.booking__ds__extract_day + , subq_12.booking__ds__extract_dayofweek + , subq_12.booking__ds__extract_dayofyear , subq_12.booking__ds_partitioned__day , subq_12.booking__ds_partitioned__week , subq_12.booking__ds_partitioned__month , subq_12.booking__ds_partitioned__quarter , subq_12.booking__ds_partitioned__year + , subq_12.booking__ds_partitioned__extract_year + , subq_12.booking__ds_partitioned__extract_quarter + , subq_12.booking__ds_partitioned__extract_month + , subq_12.booking__ds_partitioned__extract_week + , subq_12.booking__ds_partitioned__extract_day + , subq_12.booking__ds_partitioned__extract_dayofweek + , subq_12.booking__ds_partitioned__extract_dayofyear , subq_12.booking__paid_at__day , subq_12.booking__paid_at__week , subq_12.booking__paid_at__month , subq_12.booking__paid_at__quarter , subq_12.booking__paid_at__year + , subq_12.booking__paid_at__extract_year + , subq_12.booking__paid_at__extract_quarter + , subq_12.booking__paid_at__extract_month + , subq_12.booking__paid_at__extract_week + , subq_12.booking__paid_at__extract_day + , subq_12.booking__paid_at__extract_dayofweek + , subq_12.booking__paid_at__extract_dayofyear , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month @@ -406,32 +616,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -480,31 +732,73 @@ FROM ( , subq_17.ds__month , subq_17.ds__quarter , subq_17.ds__year + , subq_17.ds__extract_year + , subq_17.ds__extract_quarter + , subq_17.ds__extract_month + , subq_17.ds__extract_week + , subq_17.ds__extract_day + , subq_17.ds__extract_dayofweek + , subq_17.ds__extract_dayofyear , subq_17.ds_partitioned__day , subq_17.ds_partitioned__week , subq_17.ds_partitioned__month , subq_17.ds_partitioned__quarter , subq_17.ds_partitioned__year + , subq_17.ds_partitioned__extract_year + , subq_17.ds_partitioned__extract_quarter + , subq_17.ds_partitioned__extract_month + , subq_17.ds_partitioned__extract_week + , subq_17.ds_partitioned__extract_day + , subq_17.ds_partitioned__extract_dayofweek + , subq_17.ds_partitioned__extract_dayofyear , subq_17.paid_at__day , subq_17.paid_at__week , subq_17.paid_at__month , subq_17.paid_at__quarter , subq_17.paid_at__year + , subq_17.paid_at__extract_year + , subq_17.paid_at__extract_quarter + , subq_17.paid_at__extract_month + , subq_17.paid_at__extract_week + , subq_17.paid_at__extract_day + , subq_17.paid_at__extract_dayofweek + , subq_17.paid_at__extract_dayofyear , subq_17.booking__ds__day , subq_17.booking__ds__week , subq_17.booking__ds__month , subq_17.booking__ds__quarter , subq_17.booking__ds__year + , subq_17.booking__ds__extract_year + , subq_17.booking__ds__extract_quarter + , subq_17.booking__ds__extract_month + , subq_17.booking__ds__extract_week + , subq_17.booking__ds__extract_day + , subq_17.booking__ds__extract_dayofweek + , subq_17.booking__ds__extract_dayofyear , subq_17.booking__ds_partitioned__day , subq_17.booking__ds_partitioned__week , subq_17.booking__ds_partitioned__month , subq_17.booking__ds_partitioned__quarter , subq_17.booking__ds_partitioned__year + , subq_17.booking__ds_partitioned__extract_year + , subq_17.booking__ds_partitioned__extract_quarter + , subq_17.booking__ds_partitioned__extract_month + , subq_17.booking__ds_partitioned__extract_week + , subq_17.booking__ds_partitioned__extract_day + , subq_17.booking__ds_partitioned__extract_dayofweek + , subq_17.booking__ds_partitioned__extract_dayofyear , subq_17.booking__paid_at__day , subq_17.booking__paid_at__week , subq_17.booking__paid_at__month , subq_17.booking__paid_at__quarter , subq_17.booking__paid_at__year + , subq_17.booking__paid_at__extract_year + , subq_17.booking__paid_at__extract_quarter + , subq_17.booking__paid_at__extract_month + , subq_17.booking__paid_at__extract_week + , subq_17.booking__paid_at__extract_day + , subq_17.booking__paid_at__extract_dayofweek + , subq_17.booking__paid_at__extract_dayofyear , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month @@ -554,32 +848,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql index be96decab5..63116a5458 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql @@ -45,32 +45,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql index a5288e7009..a53f3a075b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql @@ -36,21 +36,49 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.verification__ds__day , subq_0.verification__ds__week , subq_0.verification__ds__month , subq_0.verification__ds__quarter , subq_0.verification__ds__year + , subq_0.verification__ds__extract_year + , subq_0.verification__ds__extract_quarter + , subq_0.verification__ds__extract_month + , subq_0.verification__ds__extract_week + , subq_0.verification__ds__extract_day + , subq_0.verification__ds__extract_dayofweek + , subq_0.verification__ds__extract_dayofyear , subq_0.verification__ds_partitioned__day , subq_0.verification__ds_partitioned__week , subq_0.verification__ds_partitioned__month , subq_0.verification__ds_partitioned__quarter , subq_0.verification__ds_partitioned__year + , subq_0.verification__ds_partitioned__extract_year + , subq_0.verification__ds_partitioned__extract_quarter + , subq_0.verification__ds_partitioned__extract_month + , subq_0.verification__ds_partitioned__extract_week + , subq_0.verification__ds_partitioned__extract_day + , subq_0.verification__ds_partitioned__extract_dayofweek + , subq_0.verification__ds_partitioned__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -71,22 +99,50 @@ FROM ( , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds) AS verification__ds__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds) AS verification__ds__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_dayofyear , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , EXTRACT(YEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month + , EXTRACT(WEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(DAY FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dayofyear , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user @@ -110,32 +166,74 @@ FROM ( , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS ds__extract_dayofyear , users_ds_source_src_10007.created_at AS created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state , users_ds_source_src_10007.ds AS user__ds__day , DATE_TRUNC('week', users_ds_source_src_10007.ds) AS user__ds__week , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS user__ds__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS user__ds__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS user__ds__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds) AS user__ds__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds) AS user__ds__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds) AS user__ds__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_dayofyear , users_ds_source_src_10007.created_at AS user__created_at__day , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS user__created_at__week , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS user__created_at__month , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS user__created_at__quarter , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS user__created_at__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dayofyear , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned__day , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__week , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__month , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__quarter , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__year + , EXTRACT(YEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_month + , EXTRACT(WEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week + , EXTRACT(DAY FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dayofyear , users_ds_source_src_10007.home_state AS user__home_state , users_ds_source_src_10007.user_id AS user FROM ***************************.dim_users users_ds_source_src_10007 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql index c65a58a300..d88d2d32f3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -54,12 +82,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql index 603dac8609..094486f462 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql index adfa1c3f03..a8a26c9899 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 48a1b43de5..c400372dd4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 08a913aa57..30ab4c1851 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -5,11 +5,25 @@ SELECT , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter , subq_0.ds__year AS ds__year + , subq_0.ds__extract_year AS ds__extract_year + , subq_0.ds__extract_quarter AS ds__extract_quarter + , subq_0.ds__extract_month AS ds__extract_month + , subq_0.ds__extract_week AS ds__extract_week + , subq_0.ds__extract_day AS ds__extract_day + , subq_0.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_0.ds__extract_dayofyear AS ds__extract_dayofyear , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month , subq_0.account__ds__quarter AS account__ds__quarter , subq_0.account__ds__year AS account__ds__year + , subq_0.account__ds__extract_year AS account__ds__extract_year + , subq_0.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_0.account__ds__extract_month AS account__ds__extract_month + , subq_0.account__ds__extract_week AS account__ds__extract_week + , subq_0.account__ds__extract_day AS account__ds__extract_day + , subq_0.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_0.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -55,12 +83,26 @@ INNER JOIN ( , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_dayofyear , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC('week', accounts_source_src_10000.ds) AS account__ds__week , DATE_TRUNC('month', accounts_source_src_10000.ds) AS account__ds__month , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS account__ds__quarter , DATE_TRUNC('year', accounts_source_src_10000.ds) AS account__ds__year + , EXTRACT(YEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM accounts_source_src_10000.ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(DAY FROM accounts_source_src_10000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_dayofyear , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index ed796b148d..ef337f422c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -5,11 +5,25 @@ SELECT , subq_3.ds__month AS ds__month , subq_3.ds__quarter AS ds__quarter , subq_3.ds__year AS ds__year + , subq_3.ds__extract_year AS ds__extract_year + , subq_3.ds__extract_quarter AS ds__extract_quarter + , subq_3.ds__extract_month AS ds__extract_month + , subq_3.ds__extract_week AS ds__extract_week + , subq_3.ds__extract_day AS ds__extract_day + , subq_3.ds__extract_dayofweek AS ds__extract_dayofweek + , subq_3.ds__extract_dayofyear AS ds__extract_dayofyear , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month , subq_3.account__ds__quarter AS account__ds__quarter , subq_3.account__ds__year AS account__ds__year + , subq_3.account__ds__extract_year AS account__ds__extract_year + , subq_3.account__ds__extract_quarter AS account__ds__extract_quarter + , subq_3.account__ds__extract_month AS account__ds__extract_month + , subq_3.account__ds__extract_week AS account__ds__extract_week + , subq_3.account__ds__extract_day AS account__ds__extract_day + , subq_3.account__ds__extract_dayofweek AS account__ds__extract_dayofweek + , subq_3.account__ds__extract_dayofyear AS account__ds__extract_dayofyear , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -28,12 +42,26 @@ FROM ( , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , account_type , ds AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week , DATE_TRUNC('month', ds) AS account__ds__month , DATE_TRUNC('quarter', ds) AS account__ds__quarter , DATE_TRUNC('year', ds) AS account__ds__year + , EXTRACT(YEAR FROM ds) AS account__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS account__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS account__ds__extract_month + , EXTRACT(WEEK FROM ds) AS account__ds__extract_week + , EXTRACT(DAY FROM ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_dayofyear , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql index 782ccc2826..16b897731d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql @@ -31,32 +31,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -83,11 +125,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_dayofyear , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_dayofyear , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -96,11 +152,25 @@ LEFT OUTER JOIN ( , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dayofyear , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , EXTRACT(YEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year + , EXTRACT(QUARTER FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter + , EXTRACT(MONTH FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month + , EXTRACT(WEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(DAY FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day + , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dayofyear , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql index 0f449eb59e..7dd5c3b39d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql index ee19129508..e240956212 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql @@ -20,32 +20,74 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , is_instant AS booking__is_instant , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_common_semantic_model__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_common_semantic_model__plan0.xml index f6e315621f..c0830e210b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_common_semantic_model__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_common_semantic_model__plan0.xml @@ -31,11 +31,11 @@ - + - + @@ -44,7 +44,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -63,11 +63,11 @@ - + - + @@ -76,227 +76,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -313,27 +481,27 @@ - + - + - + - + - + - + @@ -341,31 +509,31 @@ - + - + - + - + - + - + - + @@ -383,133 +551,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -528,11 +864,11 @@ - + - + @@ -541,7 +877,7 @@ - + @@ -550,7 +886,7 @@ - + @@ -560,11 +896,11 @@ - + - + @@ -573,227 +909,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -810,27 +1314,27 @@ - + - + - + - + - + - + @@ -838,31 +1342,31 @@ - + - + - + - + - + - + - + @@ -880,133 +1384,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml index 7a5de1b9b7..34419b3c74 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml @@ -92,27 +92,27 @@ - + - + - + - + - + - + @@ -120,31 +120,31 @@ - + - + - + - + - + - + - + @@ -162,133 +162,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -323,15 +491,15 @@ - + - + - + @@ -349,101 +517,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml index fc211e9645..9315fdef74 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -29,11 +29,11 @@ - + - + @@ -48,15 +48,15 @@ - + - + - + @@ -65,11 +65,11 @@ - + - + @@ -78,11 +78,11 @@ - + - + @@ -92,15 +92,15 @@ - + - + - + @@ -109,19 +109,19 @@ - + - + - + - + @@ -138,15 +138,15 @@ - + - + - + @@ -155,227 +155,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -392,27 +560,27 @@ - + - + - + - + - + - + @@ -420,31 +588,31 @@ - + - + - + - + - + - + - + @@ -462,133 +630,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -607,11 +943,11 @@ - + - + @@ -620,284 +956,508 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -918,15 +1478,15 @@ - + - + - + @@ -935,11 +1495,11 @@ - + - + @@ -948,11 +1508,11 @@ - + - + @@ -962,15 +1522,15 @@ - + - + - + @@ -979,19 +1539,19 @@ - + - + - + - + @@ -1008,15 +1568,15 @@ - + - + - + @@ -1025,123 +1585,235 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1154,7 +1826,7 @@ - + @@ -1172,81 +1844,193 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -1265,11 +2049,11 @@ - + - + @@ -1278,151 +2062,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1435,15 +2331,15 @@ - + - + - + @@ -1461,101 +2357,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml index 82a0ab149d..95cd7fa4a4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml @@ -104,27 +104,27 @@ - + - + - + - + - + - + @@ -132,31 +132,31 @@ - + - + - + - + - + - + - + @@ -174,133 +174,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -335,15 +503,15 @@ - + - + - + @@ -361,101 +529,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml index 38b865d81f..9f5069ebd5 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml @@ -92,27 +92,27 @@ - + - + - + - + - + - + @@ -120,31 +120,31 @@ - + - + - + - + - + - + - + @@ -162,133 +162,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -323,15 +491,15 @@ - + - + - + @@ -349,101 +517,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml index aec5366d3c..4dbe746624 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml @@ -62,27 +62,27 @@ - + - + - + - + - + - + @@ -90,31 +90,31 @@ - + - + - + - + - + - + - + @@ -132,133 +132,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric__plan0.xml index e821ae326f..767372469e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,75 +49,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126,11 +182,11 @@ - + - + @@ -148,33 +204,89 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_grain_to_date__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_grain_to_date__plan0.xml index e61cab14ff..0ee72e4356 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_grain_to_date__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_grain_to_date__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,75 +49,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126,11 +182,11 @@ - + - + @@ -148,33 +204,89 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_ds__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_ds__plan0.xml index 5c72bf678b..02d428e68a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_ds__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_ds__plan0.xml @@ -4,7 +4,7 @@ - + @@ -24,7 +24,7 @@ - + @@ -33,75 +33,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -110,11 +166,11 @@ - + - + @@ -132,33 +188,89 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window__plan0.xml index 2d6d46464a..a5c78af24a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,75 +49,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126,11 +182,11 @@ - + - + @@ -148,33 +204,89 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window_with_time_constraint__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window_with_time_constraint__plan0.xml index 397208997e..836bc1a09c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window_with_time_constraint__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_no_window_with_time_constraint__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -50,75 +50,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -127,75 +183,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -204,11 +316,11 @@ - + - + @@ -226,33 +338,89 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_with_time_constraint__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_with_time_constraint__plan0.xml index 5ecd845045..db9917690c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_with_time_constraint__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_cumulative_metric_with_time_constraint__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -50,75 +50,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -127,75 +183,131 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -204,11 +316,11 @@ - + - + @@ -226,33 +338,89 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric__plan0.xml index e1fff36d2d..47028f82c6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -85,227 +85,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +490,27 @@ - + - + - + - + - + - + @@ -350,31 +518,31 @@ - + - + - + - + - + - + - + @@ -392,133 +560,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +873,11 @@ - + - + @@ -550,7 +886,7 @@ - + @@ -559,7 +895,7 @@ - + @@ -569,11 +905,11 @@ - + - + @@ -582,227 +918,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -819,27 +1323,27 @@ - + - + - + - + - + - + @@ -847,31 +1351,31 @@ - + - + - + - + - + - + - + @@ -889,133 +1393,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain__plan0.xml index b79bb65ee4..9b112de652 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -85,227 +85,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +490,27 @@ - + - + - + - + - + - + @@ -350,31 +518,31 @@ - + - + - + - + - + - + - + @@ -392,133 +560,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +873,11 @@ - + - + @@ -550,7 +886,7 @@ - + @@ -559,7 +895,7 @@ - + @@ -569,11 +905,11 @@ - + - + @@ -582,211 +918,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1305,7 @@ - + @@ -816,227 +1320,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1725,27 @@ - + - + - + - + - + - + @@ -1081,31 +1753,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1795,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain_and_granularity__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain_and_granularity__plan0.xml index d83dd52e3e..50437f494c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain_and_granularity__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_to_grain_and_granularity__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -85,227 +85,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +490,27 @@ - + - + - + - + - + - + @@ -350,31 +518,31 @@ - + - + - + - + - + - + - + @@ -392,133 +560,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +873,11 @@ - + - + @@ -550,7 +886,7 @@ - + @@ -559,7 +895,7 @@ - + @@ -569,11 +905,11 @@ - + - + @@ -586,207 +922,375 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1305,7 @@ - + @@ -816,227 +1320,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1725,27 @@ - + - + - + - + - + - + @@ -1081,31 +1753,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1795,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window__plan0.xml index aaebb9841d..c61572cec8 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -85,227 +85,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +490,27 @@ - + - + - + - + - + - + @@ -350,31 +518,31 @@ - + - + - + - + - + - + - + @@ -392,133 +560,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +873,11 @@ - + - + @@ -550,7 +886,7 @@ - + @@ -559,7 +895,7 @@ - + @@ -569,11 +905,11 @@ - + - + @@ -582,211 +918,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1305,7 @@ - + @@ -816,227 +1320,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1725,27 @@ - + - + - + - + - + - + @@ -1081,31 +1753,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1795,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_granularity__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_granularity__plan0.xml index 3d9f926162..ab7df49f61 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_granularity__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_granularity__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -85,227 +85,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +490,27 @@ - + - + - + - + - + - + @@ -350,31 +518,31 @@ - + - + - + - + - + - + - + @@ -392,133 +560,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +873,11 @@ - + - + @@ -550,7 +886,7 @@ - + @@ -559,7 +895,7 @@ - + @@ -569,11 +905,11 @@ - + - + @@ -586,207 +922,375 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1305,7 @@ - + @@ -816,227 +1320,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1725,27 @@ - + - + - + - + - + - + @@ -1081,31 +1753,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1795,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.xml index d5bb60eb4f..964ca40404 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -85,211 +85,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -304,7 +472,7 @@ - + @@ -319,227 +487,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -556,27 +892,27 @@ - + - + - + - + - + - + @@ -584,31 +920,31 @@ - + - + - + - + - + - + - + @@ -626,133 +962,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -772,11 +1276,11 @@ - + - + @@ -785,7 +1289,7 @@ - + @@ -794,7 +1298,7 @@ - + @@ -804,11 +1308,11 @@ - + - + @@ -817,211 +1321,379 @@ - + - + - + - + - + - + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1036,7 +1708,7 @@ - + @@ -1051,227 +1723,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1288,27 +2128,27 @@ - + - + - + - + - + - + @@ -1316,31 +2156,31 @@ - + - + - + - + - + - + - + @@ -1358,133 +2198,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.xml index 5d76366353..bf2ebf93fd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -89,207 +89,375 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -304,7 +472,7 @@ - + @@ -319,227 +487,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -556,27 +892,27 @@ - + - + - + - + - + - + @@ -584,31 +920,31 @@ - + - + - + - + - + - + - + @@ -626,133 +962,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -772,11 +1276,11 @@ - + - + @@ -785,7 +1289,7 @@ - + @@ -794,7 +1298,7 @@ - + @@ -804,11 +1308,11 @@ - + - + @@ -821,207 +1325,375 @@ - + - + - + - + - + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1036,7 +1708,7 @@ - + @@ -1051,227 +1723,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1288,27 +2128,27 @@ - + - + - + - + - + - + @@ -1316,31 +2156,31 @@ - + - + - + - + - + - + - + @@ -1358,133 +2198,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_cumulative_metric__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_cumulative_metric__plan0.xml index 835975e4c7..b4604d9a7a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_cumulative_metric__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_cumulative_metric__plan0.xml @@ -4,7 +4,7 @@ - + @@ -17,11 +17,11 @@ - + - + @@ -30,7 +30,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -49,11 +49,11 @@ - + - + @@ -62,211 +62,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -281,7 +449,7 @@ - + @@ -296,227 +464,395 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -531,7 +867,7 @@ - + @@ -546,227 +882,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -783,27 +1287,27 @@ - + - + - + - + - + - + @@ -811,31 +1315,31 @@ - + - + - + - + - + - + - + @@ -853,133 +1357,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_metric_with_one_input_metric__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_metric_with_one_input_metric__plan0.xml index 3cb4bc87d8..edcddda734 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_metric_with_one_input_metric__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_derived_offset_metric_with_one_input_metric__plan0.xml @@ -4,7 +4,7 @@ - + @@ -17,11 +17,11 @@ - + - + @@ -30,7 +30,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -49,11 +49,11 @@ - + - + @@ -62,211 +62,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -281,7 +449,7 @@ - + @@ -296,227 +464,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -533,27 +869,27 @@ - + - + - + - + - + - + @@ -561,31 +897,31 @@ - + - + - + - + - + - + - + @@ -603,133 +939,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_distinct_values__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_distinct_values__plan0.xml index 0a98623c4d..07444a9b99 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_distinct_values__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_distinct_values__plan0.xml @@ -4,13 +4,13 @@ - + - + @@ -19,7 +19,7 @@ - + @@ -28,11 +28,11 @@ - + - + @@ -41,7 +41,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -60,11 +60,11 @@ - + - + @@ -73,15 +73,15 @@ - + - + - + @@ -98,11 +98,11 @@ - + - + @@ -111,227 +111,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -348,27 +516,27 @@ - + - + - + - + - + - + @@ -376,31 +544,31 @@ - + - + - + - + - + - + - + @@ -418,133 +586,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -563,11 +899,11 @@ - + - + @@ -576,151 +912,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -733,15 +1181,15 @@ - + - + - + @@ -759,101 +1207,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml index e6bdd09af0..fcfe3e55b0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml @@ -23,27 +23,27 @@ - + - + - + - + - + - + @@ -51,31 +51,31 @@ - + - + - + - + - + - + - + @@ -93,133 +93,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml index be8b76158e..3588eccfef 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml @@ -41,27 +41,27 @@ - + - + - + - + - + - + @@ -69,31 +69,31 @@ - + - + - + - + - + - + - + @@ -111,133 +111,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_on_join_dim__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_on_join_dim__plan0.xml index 5cfd7e07dd..38e7f01169 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_on_join_dim__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_on_join_dim__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,15 +49,15 @@ - + - + - + @@ -69,15 +69,15 @@ - + - + - + @@ -86,19 +86,19 @@ - + - + - + - + @@ -115,15 +115,15 @@ - + - + - + @@ -132,227 +132,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -369,27 +537,27 @@ - + - + - + - + - + - + @@ -397,31 +565,31 @@ - + - + - + - + - + - + - + @@ -439,133 +607,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -584,11 +920,11 @@ - + - + @@ -597,151 +933,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -754,15 +1202,15 @@ - + - + - + @@ -780,101 +1228,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml index 039becd5f3..d425456404 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,15 +49,15 @@ - + - + - + @@ -69,15 +69,15 @@ - + - + - + @@ -86,27 +86,27 @@ - + - - - - - - + + + + + + - + - + - + @@ -123,15 +123,15 @@ - + - + - + @@ -140,203 +140,371 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -353,27 +521,27 @@ - + - + - + - + - + - + @@ -391,141 +559,309 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -544,19 +880,19 @@ - - + + - - + + - + - + @@ -565,7 +901,7 @@ - + @@ -583,101 +919,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml index e97315791a..d707b51e98 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml @@ -2,18 +2,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + @@ -25,10 +25,10 @@ - - - - + + + + @@ -40,14 +40,14 @@ - - - - - - - - + + + + + + + + @@ -57,27 +57,27 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + @@ -86,15 +86,15 @@ - + - - - - + + + + - + @@ -124,204 +124,372 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -340,27 +508,27 @@ - + - + - + - + - + - + @@ -368,31 +536,31 @@ - + - + - + - + - + - + - + @@ -410,133 +578,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml index e97315791a..d707b51e98 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml @@ -2,18 +2,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + @@ -25,10 +25,10 @@ - - - - + + + + @@ -40,14 +40,14 @@ - - - - - - - - + + + + + + + + @@ -57,27 +57,27 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + @@ -86,15 +86,15 @@ - + - - - - + + + + - + @@ -124,204 +124,372 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -340,27 +508,27 @@ - + - + - + - + - + - + @@ -368,31 +536,31 @@ - + - + - + - + - + - + - + @@ -410,133 +578,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml index e97315791a..d707b51e98 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml @@ -2,18 +2,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + @@ -25,10 +25,10 @@ - - - - + + + + @@ -40,14 +40,14 @@ - - - - - - - - + + + + + + + + @@ -57,27 +57,27 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + @@ -86,15 +86,15 @@ - + - - - - + + + + - + @@ -124,204 +124,372 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -340,27 +508,27 @@ - + - + - + - + - + - + @@ -368,31 +536,31 @@ - + - + - + - + - + - + - + @@ -410,133 +578,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_limit_rows__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_limit_rows__plan0.xml index 2ad699be1e..eb918937d1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_limit_rows__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_limit_rows__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,11 +17,11 @@ - + - + @@ -30,7 +30,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -49,11 +49,11 @@ - + - + @@ -62,227 +62,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -299,27 +467,27 @@ - + - + - + - + - + - + @@ -327,31 +495,31 @@ - + - + - + - + - + - + - + @@ -369,133 +537,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_local_dimension_using_local_entity__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_local_dimension_using_local_entity__plan0.xml index 6d1aa61883..0c406fa13f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_local_dimension_using_local_entity__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_local_dimension_using_local_entity__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,151 +49,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -206,15 +318,15 @@ - + - + - + @@ -232,101 +344,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml index 6f19ddfe1f..aa58e56a77 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml @@ -56,27 +56,27 @@ - + - + - + - + - + - + @@ -84,31 +84,31 @@ - + - + - + - + - + - + - + @@ -126,133 +126,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint__plan0.xml index 286024abca..861a4944cd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,15 +21,15 @@ - + - + - + @@ -50,11 +50,11 @@ - + - + @@ -63,7 +63,7 @@ - + @@ -72,7 +72,7 @@ - + @@ -82,11 +82,11 @@ - + - + @@ -95,15 +95,15 @@ - + - + - + @@ -115,15 +115,15 @@ - + - + - + @@ -132,19 +132,19 @@ - + - + - + - + @@ -161,15 +161,15 @@ - + - + - + @@ -178,227 +178,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -415,27 +583,27 @@ - + - + - + - + - + - + @@ -443,31 +611,31 @@ - + - + - + - + - + - + - + @@ -485,133 +653,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -630,11 +966,11 @@ - + - + @@ -643,151 +979,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -800,15 +1248,15 @@ - + - + - + @@ -826,101 +1274,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -943,11 +1503,11 @@ - + - + @@ -956,7 +1516,7 @@ - + @@ -965,7 +1525,7 @@ - + @@ -975,11 +1535,11 @@ - + - + @@ -988,15 +1548,15 @@ - + - + - + @@ -1008,15 +1568,15 @@ - + - + - + @@ -1025,19 +1585,19 @@ - + - + - + - + @@ -1054,15 +1614,15 @@ - + - + - + @@ -1071,227 +1631,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1308,27 +2036,27 @@ - + - + - + - + - + - + @@ -1336,31 +2064,31 @@ - + - + - + - + - + - + - + @@ -1378,133 +2106,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -1523,11 +2419,11 @@ - + - + @@ -1536,151 +2432,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1693,15 +2701,15 @@ - + - + - + @@ -1719,101 +2727,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -1836,11 +2956,11 @@ - + - + @@ -1849,7 +2969,7 @@ - + @@ -1858,7 +2978,7 @@ - + @@ -1868,11 +2988,11 @@ - + - + @@ -1881,227 +3001,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -2118,27 +3406,27 @@ - + - + - + - + - + - + @@ -2146,31 +3434,31 @@ - + - + - + - + - + - + - + @@ -2188,133 +3476,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_reused_measure__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_reused_measure__plan0.xml index 7ac1680f62..44372c125e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_reused_measure__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_reused_measure__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,11 +21,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,11 +72,11 @@ - + - + @@ -85,15 +85,15 @@ - + - + - + @@ -105,15 +105,15 @@ - + - + - + @@ -122,227 +122,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -359,27 +527,27 @@ - + - + - + - + - + - + @@ -387,31 +555,31 @@ - + - + - + - + - + - + - + @@ -429,133 +597,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -576,11 +912,11 @@ - + - + @@ -589,7 +925,7 @@ - + @@ -598,7 +934,7 @@ - + @@ -608,11 +944,11 @@ - + - + @@ -621,227 +957,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -858,27 +1362,27 @@ - + - + - + - + - + - + @@ -886,31 +1390,31 @@ - + - + - + - + - + - + - + @@ -928,133 +1432,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_single_expr_and_alias__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_single_expr_and_alias__plan0.xml index cf76b6c264..c22e5aaa2c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_single_expr_and_alias__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_constraint_with_single_expr_and_alias__plan0.xml @@ -4,7 +4,7 @@ - + @@ -17,11 +17,11 @@ - + - + @@ -30,7 +30,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -49,11 +49,11 @@ - + - + @@ -62,15 +62,15 @@ - + - + - + @@ -82,15 +82,15 @@ - + - + - + @@ -99,227 +99,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -336,27 +504,27 @@ - + - + - + - + - + - + @@ -364,31 +532,31 @@ - + - + - + - + - + - + - + @@ -406,133 +574,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.xml index bc37ee4ba5..700630d85f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.xml @@ -13,11 +13,11 @@ - + - + @@ -32,7 +32,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -61,227 +61,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -298,27 +466,27 @@ - + - + - + - + - + - + @@ -326,31 +494,31 @@ - + - + - + - + - + - + - + @@ -368,133 +536,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -513,7 +849,7 @@ - + @@ -533,7 +869,7 @@ - + @@ -542,151 +878,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -699,15 +1147,15 @@ - + - + - + @@ -725,101 +1173,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml index 61d600e32e..b0b4994668 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml @@ -4,15 +4,15 @@ - + - + - + @@ -21,11 +21,11 @@ - + - + @@ -34,11 +34,11 @@ - + - + @@ -48,15 +48,15 @@ - + - + - + @@ -65,27 +65,27 @@ - + - - - - - - + + + + + + - + - + - + @@ -102,15 +102,15 @@ - + - + - + @@ -119,203 +119,371 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -332,27 +500,27 @@ - + - + - + - + - + - + @@ -370,141 +538,309 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -523,19 +859,19 @@ - - + + - - + + - + - + @@ -544,143 +880,283 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + @@ -695,7 +1171,7 @@ - + @@ -713,101 +1189,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + @@ -827,64 +1415,134 @@ + + + + + + + + + + + + + + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -893,7 +1551,7 @@ - + @@ -911,37 +1569,93 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml index af8393dcd6..56636965eb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml @@ -4,15 +4,15 @@ - + - + - + @@ -21,11 +21,11 @@ - + - + @@ -34,11 +34,11 @@ - + - + @@ -48,15 +48,15 @@ - + - + - + @@ -65,27 +65,27 @@ - + - - - - - - - - + + + + + + + + - + - + - + @@ -102,15 +102,15 @@ - + - + - + @@ -119,203 +119,371 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -332,27 +500,27 @@ - + - + - + - + - + - + @@ -370,141 +538,309 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -524,21 +860,21 @@ - - - - - - - - + + + + + + + + - + - + @@ -547,59 +883,115 @@ - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -614,15 +1006,15 @@ - + - + - + @@ -643,114 +1035,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -759,7 +1291,7 @@ - + @@ -777,77 +1309,189 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml index dfaf625e64..86c66d0258 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml @@ -60,27 +60,27 @@ - + - + - + - + - + - + @@ -88,31 +88,31 @@ - + - + - + - + - + - + - + @@ -130,133 +130,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -291,15 +459,15 @@ - + - + - + @@ -317,101 +485,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -446,15 +726,15 @@ - + - + - + @@ -472,101 +752,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml index c6279b9625..9f9193531e 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,23 +49,23 @@ - + - + - + - + - + @@ -82,137 +82,249 @@ - + - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -220,11 +332,11 @@ - + - + @@ -242,77 +354,189 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -331,15 +555,15 @@ - + - + - + @@ -348,91 +572,175 @@ - + - + - + - + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -447,11 +755,11 @@ - + - + @@ -469,41 +777,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -525,72 +889,142 @@ + + + + + + + + + + + + + + - + - + - + - + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + @@ -599,15 +1033,15 @@ - + - + - + @@ -625,37 +1059,93 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multiple_metrics_no_dimensions__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multiple_metrics_no_dimensions__plan0.xml index 93e976b5aa..cbd37b5a97 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multiple_metrics_no_dimensions__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multiple_metrics_no_dimensions__plan0.xml @@ -23,7 +23,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -53,227 +53,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -282,227 +450,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -519,27 +855,27 @@ - + - + - + - + - + - + @@ -547,31 +883,31 @@ - + - + - + - + - + - + - + @@ -589,133 +925,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -733,10 +1237,10 @@ - - - - + + + + @@ -753,164 +1257,276 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -918,151 +1534,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1075,15 +1803,15 @@ - + - + - + @@ -1101,101 +1829,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_nested_derived_metric__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_nested_derived_metric__plan0.xml index 5ad4e40835..ebf9d2d655 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_nested_derived_metric__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_nested_derived_metric__plan0.xml @@ -4,7 +4,7 @@ - + @@ -21,15 +21,15 @@ - + - + - + @@ -50,7 +50,7 @@ - + @@ -67,11 +67,11 @@ - + - + @@ -86,11 +86,11 @@ - + - + @@ -99,7 +99,7 @@ - + @@ -108,7 +108,7 @@ - + @@ -118,11 +118,11 @@ - + - + @@ -131,227 +131,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -368,27 +536,27 @@ - + - + - + - + - + - + @@ -396,31 +564,31 @@ - + - + - + - + - + - + - + @@ -438,133 +606,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -583,11 +919,11 @@ - + - + @@ -596,7 +932,7 @@ - + @@ -605,7 +941,7 @@ - + @@ -615,11 +951,11 @@ - + - + @@ -628,227 +964,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -865,27 +1369,27 @@ - + - + - + - + - + - + @@ -893,31 +1397,31 @@ - + - + - + - + - + - + - + @@ -935,133 +1439,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -1082,11 +1754,11 @@ - + - + @@ -1095,7 +1767,7 @@ - + @@ -1104,7 +1776,7 @@ - + @@ -1114,11 +1786,11 @@ - + - + @@ -1127,227 +1799,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1364,27 +2204,27 @@ - + - + - + - + - + - + @@ -1392,31 +2232,31 @@ - + - + - + - + - + - + - + @@ -1434,133 +2274,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -1579,11 +2587,11 @@ - + - + @@ -1592,7 +2600,7 @@ - + @@ -1601,7 +2609,7 @@ - + @@ -1611,11 +2619,11 @@ - + - + @@ -1624,227 +2632,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1861,27 +3037,27 @@ - + - + - + - + - + - + @@ -1889,31 +3065,31 @@ - + - + - + - + - + - + - + @@ -1931,133 +3107,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml index 8a1b7def27..dd1374fbd4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml @@ -98,27 +98,27 @@ - + - + - + - + - + - + @@ -126,31 +126,31 @@ - + - + - + - + - + - + - + @@ -168,133 +168,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_partitioned_join__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_partitioned_join__plan0.xml index 26789f01a6..175032c65b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_partitioned_join__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_partitioned_join__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,23 +49,23 @@ - + - + - + - + - + @@ -82,15 +82,15 @@ - + - + - + @@ -99,127 +99,239 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -232,7 +344,7 @@ - + @@ -250,85 +362,197 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -347,15 +571,15 @@ - + - + - + @@ -364,7 +588,7 @@ - + @@ -382,117 +606,285 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml index ea9d4375ce..132ec029e6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml @@ -25,48 +25,104 @@ - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -113,41 +169,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -201,41 +313,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml index e3e3940b46..cceeec487f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml @@ -25,48 +25,104 @@ - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -113,41 +169,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -209,41 +321,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml index 22a9628ef1..f030246e44 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml @@ -25,48 +25,104 @@ - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -113,41 +169,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -209,41 +321,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml index 23bf64d5f1..e1cc885427 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml @@ -46,27 +46,27 @@ - + - + - + - + - + - + @@ -74,31 +74,31 @@ - + - + - + - + - + - + - + @@ -116,133 +116,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -277,15 +445,15 @@ - + - + - + @@ -303,101 +471,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml index 9b0610cf8b..c497bc5f85 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml @@ -12,27 +12,27 @@ - + - + - + - + - + - + @@ -40,31 +40,31 @@ - + - + - + - + - + - + - + @@ -82,133 +82,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index 0438bcd3c2..343e8eb274 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.paid_at__day AS metric_time__day , subq_0.paid_at__week AS metric_time__week , subq_0.paid_at__month AS metric_time__month @@ -67,32 +109,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index be6e7930be..6e9ffdb258 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC(ds, month) AS ds__month , DATE_TRUNC(ds, quarter) AS ds__quarter , DATE_TRUNC(ds, year) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC(paid_at, isoweek) AS paid_at__week , DATE_TRUNC(paid_at, month) AS paid_at__month , DATE_TRUNC(paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC(ds, isoweek) AS booking__ds__week , DATE_TRUNC(ds, month) AS booking__ds__month , DATE_TRUNC(ds, quarter) AS booking__ds__quarter , DATE_TRUNC(ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(paid_at, month) AS booking__paid_at__month , DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , paid_at AS metric_time__day , DATE_TRUNC(paid_at, isoweek) AS metric_time__week , DATE_TRUNC(paid_at, month) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index dfebc400e0..1d6c177790 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -79,32 +121,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index d014cb232e..ac5f560577 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC(ds, month) AS ds__month , DATE_TRUNC(ds, quarter) AS ds__quarter , DATE_TRUNC(ds, year) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC(paid_at, isoweek) AS paid_at__week , DATE_TRUNC(paid_at, month) AS paid_at__month , DATE_TRUNC(paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC(ds, isoweek) AS booking__ds__week , DATE_TRUNC(ds, month) AS booking__ds__month , DATE_TRUNC(ds, quarter) AS booking__ds__quarter , DATE_TRUNC(ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(paid_at, month) AS booking__paid_at__month , DATE_TRUNC(paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , ds AS metric_time__day , DATE_TRUNC(ds, isoweek) AS metric_time__week , DATE_TRUNC(ds, month) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql index da1967d18d..95a2765eec 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.paid_at__day AS metric_time__day , subq_5.paid_at__week AS metric_time__week , subq_5.paid_at__month AS metric_time__month @@ -227,32 +353,74 @@ FULL OUTER JOIN ( , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index d85b98c372..7546e82b35 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.paid_at__day AS metric_time__day , subq_0.paid_at__week AS metric_time__week , subq_0.paid_at__month AS metric_time__month @@ -67,32 +109,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 8f68ad52d4..dd88a042dc 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM paid_at) AS booking__paid_at__extract_dayofyear , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 7c20f14f7c..e3908e0d03 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -79,32 +121,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 7c661d75a0..e739399f60 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM paid_at) AS booking__paid_at__extract_dayofyear , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql index 4141b83082..08e9c6f6fa 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Databricks/test_simple_query_with_metric_time_dimension__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.paid_at__day AS metric_time__day , subq_5.paid_at__week AS metric_time__week , subq_5.paid_at__month AS metric_time__month @@ -227,32 +353,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DOY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index d85b98c372..4f359630e6 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.paid_at__day AS metric_time__day , subq_0.paid_at__week AS metric_time__week , subq_0.paid_at__month AS metric_time__month @@ -67,32 +109,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 8f68ad52d4..ed2c8def7c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 7c20f14f7c..3acc2d08e5 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -79,32 +121,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 7c661d75a0..541c754a5a 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql index 4141b83082..9a64eefccb 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DuckDB/test_simple_query_with_metric_time_dimension__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.paid_at__day AS metric_time__day , subq_5.paid_at__week AS metric_time__week , subq_5.paid_at__month AS metric_time__month @@ -227,32 +353,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index d85b98c372..4f359630e6 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.paid_at__day AS metric_time__day , subq_0.paid_at__week AS metric_time__week , subq_0.paid_at__month AS metric_time__month @@ -67,32 +109,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 8f68ad52d4..ed2c8def7c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 7c20f14f7c..3acc2d08e5 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -79,32 +121,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 7c661d75a0..541c754a5a 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql index 4141b83082..9a64eefccb 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Postgres/test_simple_query_with_metric_time_dimension__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.paid_at__day AS metric_time__day , subq_5.paid_at__week AS metric_time__week , subq_5.paid_at__month AS metric_time__month @@ -227,32 +353,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index d85b98c372..4f359630e6 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.paid_at__day AS metric_time__day , subq_0.paid_at__week AS metric_time__week , subq_0.paid_at__month AS metric_time__month @@ -67,32 +109,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 8f68ad52d4..ed2c8def7c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 7c20f14f7c..3acc2d08e5 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -79,32 +121,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 7c661d75a0..541c754a5a 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql index 4141b83082..9a64eefccb 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Redshift/test_simple_query_with_metric_time_dimension__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.paid_at__day AS metric_time__day , subq_5.paid_at__week AS metric_time__week , subq_5.paid_at__month AS metric_time__month @@ -227,32 +353,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index d85b98c372..4f359630e6 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.paid_at__day AS metric_time__day , subq_0.paid_at__week AS metric_time__week , subq_0.paid_at__month AS metric_time__month @@ -67,32 +109,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index 8f68ad52d4..ed2c8def7c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 7c20f14f7c..3acc2d08e5 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -5,31 +5,73 @@ SELECT , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -79,32 +121,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 7c661d75a0..541c754a5a 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -6,31 +6,73 @@ SELECT , DATE_TRUNC('month', ds) AS ds__month , DATE_TRUNC('quarter', ds) AS ds__quarter , DATE_TRUNC('year', ds) AS ds__year + , EXTRACT(YEAR FROM ds) AS ds__extract_year + , EXTRACT(QUARTER FROM ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS ds__extract_month + , EXTRACT(WEEK FROM ds) AS ds__extract_week + , EXTRACT(DAY FROM ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_dayofyear , ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_dayofyear , paid_at AS paid_at__day , DATE_TRUNC('week', paid_at) AS paid_at__week , DATE_TRUNC('month', paid_at) AS paid_at__month , DATE_TRUNC('quarter', paid_at) AS paid_at__quarter , DATE_TRUNC('year', paid_at) AS paid_at__year + , EXTRACT(YEAR FROM paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_dayofyear , ds AS booking__ds__day , DATE_TRUNC('week', ds) AS booking__ds__week , DATE_TRUNC('month', ds) AS booking__ds__month , DATE_TRUNC('quarter', ds) AS booking__ds__quarter , DATE_TRUNC('year', ds) AS booking__ds__year + , EXTRACT(YEAR FROM ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_dayofyear , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , paid_at AS booking__paid_at__day , DATE_TRUNC('week', paid_at) AS booking__paid_at__week , DATE_TRUNC('month', paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_dayofyear , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql index 4141b83082..9a64eefccb 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/Snowflake/test_simple_query_with_metric_time_dimension__plan0.sql @@ -27,31 +27,73 @@ FROM ( , subq_0.ds__month , subq_0.ds__quarter , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dayofweek + , subq_0.ds__extract_dayofyear , subq_0.ds_partitioned__day , subq_0.ds_partitioned__week , subq_0.ds_partitioned__month , subq_0.ds_partitioned__quarter , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dayofweek + , subq_0.ds_partitioned__extract_dayofyear , subq_0.paid_at__day , subq_0.paid_at__week , subq_0.paid_at__month , subq_0.paid_at__quarter , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dayofweek + , subq_0.paid_at__extract_dayofyear , subq_0.booking__ds__day , subq_0.booking__ds__week , subq_0.booking__ds__month , subq_0.booking__ds__quarter , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dayofweek + , subq_0.booking__ds__extract_dayofyear , subq_0.booking__ds_partitioned__day , subq_0.booking__ds_partitioned__week , subq_0.booking__ds_partitioned__month , subq_0.booking__ds_partitioned__quarter , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dayofweek + , subq_0.booking__ds_partitioned__extract_dayofyear , subq_0.booking__paid_at__day , subq_0.booking__paid_at__week , subq_0.booking__paid_at__month , subq_0.booking__paid_at__quarter , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dayofweek + , subq_0.booking__paid_at__extract_dayofyear , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month @@ -101,32 +143,74 @@ FROM ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -165,31 +249,73 @@ FULL OUTER JOIN ( , subq_5.ds__month , subq_5.ds__quarter , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dayofweek + , subq_5.ds__extract_dayofyear , subq_5.ds_partitioned__day , subq_5.ds_partitioned__week , subq_5.ds_partitioned__month , subq_5.ds_partitioned__quarter , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dayofweek + , subq_5.ds_partitioned__extract_dayofyear , subq_5.paid_at__day , subq_5.paid_at__week , subq_5.paid_at__month , subq_5.paid_at__quarter , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dayofweek + , subq_5.paid_at__extract_dayofyear , subq_5.booking__ds__day , subq_5.booking__ds__week , subq_5.booking__ds__month , subq_5.booking__ds__quarter , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dayofweek + , subq_5.booking__ds__extract_dayofyear , subq_5.booking__ds_partitioned__day , subq_5.booking__ds_partitioned__week , subq_5.booking__ds_partitioned__month , subq_5.booking__ds_partitioned__quarter , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dayofweek + , subq_5.booking__ds_partitioned__extract_dayofyear , subq_5.booking__paid_at__day , subq_5.booking__paid_at__week , subq_5.booking__paid_at__month , subq_5.booking__paid_at__quarter , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dayofweek + , subq_5.booking__paid_at__extract_dayofyear , subq_5.paid_at__day AS metric_time__day , subq_5.paid_at__week AS metric_time__week , subq_5.paid_at__month AS metric_time__month @@ -227,32 +353,74 @@ FULL OUTER JOIN ( , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dayofyear , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_dayofyear , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(YEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dayofyear , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(YEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(QUARTER FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(MONTH FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(WEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(DAY FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofweek + , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dayofyear , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml index 472402b294..c9e54613ef 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml @@ -25,156 +25,324 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -193,27 +361,27 @@ - + - + - + - + - + - + @@ -221,31 +389,31 @@ - + - + - + - + - + - + - + @@ -263,133 +431,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml index 6064b575cc..e540f55e93 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml @@ -25,204 +25,372 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -241,27 +409,27 @@ - + - + - + - + - + - + @@ -269,31 +437,31 @@ - + - + - + - + - + - + - + @@ -311,133 +479,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml index 612b73007d..14997b6627 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml @@ -31,11 +31,11 @@ - + - + @@ -44,7 +44,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -63,11 +63,11 @@ - + - + @@ -76,227 +76,395 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -313,27 +481,27 @@ - + - + - + - + - + - + @@ -341,31 +509,31 @@ - + - + - + - + - + - + - + @@ -383,133 +551,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -528,11 +864,11 @@ - + - + @@ -541,7 +877,7 @@ - + @@ -550,7 +886,7 @@ - + @@ -560,11 +896,11 @@ - + - + @@ -573,179 +909,347 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -762,27 +1266,27 @@ - + - + - + - + - + - + @@ -790,31 +1294,31 @@ - + - + - + - + - + - + - + @@ -832,133 +1336,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml index ff4e3095e1..fea487abac 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml @@ -34,6 +34,7 @@ + @@ -65,6 +66,7 @@ + @@ -132,6 +134,7 @@ + @@ -163,6 +166,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml index 567f1b3146..3b32bfb08a 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfpo_0.xml @@ -40,6 +40,7 @@ + @@ -75,6 +76,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml index 6e1d6b4714..e77cb19195 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml @@ -34,6 +34,7 @@ + @@ -77,6 +78,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml index 34e73d06a2..d3ee23ea35 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfpo_0.xml @@ -34,6 +34,7 @@ + @@ -77,6 +78,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml index 1f42c277f8..01ba8a68c5 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml @@ -48,6 +48,7 @@ + @@ -91,6 +92,7 @@ + @@ -150,6 +152,7 @@ + @@ -193,6 +196,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml index d8a77edaeb..defb580aff 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfpo_0.xml @@ -75,6 +75,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml index 9475198ca2..59589a8c8a 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml @@ -34,6 +34,7 @@ + @@ -77,6 +78,7 @@ + @@ -120,6 +122,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml index 0b0f3c1d06..7b4e7ec6e8 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfpo_0.xml @@ -45,6 +45,7 @@ + @@ -88,6 +89,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml index 8b2fc3bdcb..9003e62d30 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml @@ -34,6 +34,7 @@ + @@ -87,6 +88,7 @@ + @@ -120,6 +122,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml index 5985e50ac7..eeaa437cc5 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfpo_0.xml @@ -34,6 +34,7 @@ + @@ -87,6 +88,7 @@ + @@ -120,6 +122,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml index 8f72acf134..8d663c8802 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml @@ -43,6 +43,7 @@ + @@ -86,6 +87,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml index 0892b0a651..97636fa2d4 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfpo_0.xml @@ -50,6 +50,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml index fe405e35b4..2a8cc7308e 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml @@ -34,6 +34,7 @@ + @@ -91,6 +92,7 @@ + @@ -134,6 +136,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml index 4236d7a342..8286ae3ddb 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfpo_0.xml @@ -34,6 +34,7 @@ + @@ -98,6 +99,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml index 94e4d36375..a7b7790b04 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml @@ -57,6 +57,7 @@ + @@ -100,6 +101,7 @@ + @@ -145,6 +147,7 @@ + @@ -188,6 +191,7 @@ + diff --git a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml index 294f42931e..74c85eef7a 100644 --- a/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml +++ b/metricflow/test/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfpo_0.xml @@ -64,6 +64,7 @@ + @@ -119,6 +120,7 @@ + diff --git a/metricflow/time/date_part.py b/metricflow/time/date_part.py new file mode 100644 index 0000000000..b6ccea9172 --- /dev/null +++ b/metricflow/time/date_part.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +from enum import Enum + +from dbt_semantic_interfaces.enum_extension import assert_values_exhausted +from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity + + +class DatePart(Enum): + """Date parts able to be extracted from a time dimension. + + TODO: add support for hour, minute, second once those granularities are available + """ + + YEAR = "year" + QUARTER = "quarter" + MONTH = "month" + WEEK = "week" + DAY = "day" + DAYOFWEEK = "dayofweek" + DAYOFYEAR = "dayofyear" + + def to_int(self) -> int: + """Convert to an int so that the size of the granularity can be easily compared.""" + if self is DatePart.DAY: + return TimeGranularity.DAY.to_int() + elif self is DatePart.DAYOFWEEK: + return TimeGranularity.DAY.to_int() + elif self is DatePart.DAYOFYEAR: + return TimeGranularity.DAY.to_int() + elif self is DatePart.WEEK: + return TimeGranularity.WEEK.to_int() + elif self is DatePart.MONTH: + return TimeGranularity.MONTH.to_int() + elif self is DatePart.QUARTER: + return TimeGranularity.QUARTER.to_int() + elif self is DatePart.YEAR: + return TimeGranularity.YEAR.to_int() + else: + assert_values_exhausted(self) diff --git a/metricflow/time/time_granularity.py b/metricflow/time/time_granularity.py index a08beb2431..c96909d375 100644 --- a/metricflow/time/time_granularity.py +++ b/metricflow/time/time_granularity.py @@ -36,7 +36,7 @@ def is_period_start(time_granularity: TimeGranularity, date: Union[pd.Timestamp, if time_granularity is TimeGranularity.DAY: return True elif time_granularity is TimeGranularity.WEEK: - return ISOWeekDay.from_pandas_timestamp(pd_date).is_week_start + return ISODAYOFWEEK.from_pandas_timestamp(pd_date).is_week_start elif time_granularity is TimeGranularity.MONTH: return pd_date.is_month_start elif time_granularity is TimeGranularity.QUARTER: @@ -53,7 +53,7 @@ def is_period_end(time_granularity: TimeGranularity, date: Union[pd.Timestamp, d if time_granularity is TimeGranularity.DAY: return True elif time_granularity is TimeGranularity.WEEK: - return ISOWeekDay.from_pandas_timestamp(pd_date).is_week_end + return ISODAYOFWEEK.from_pandas_timestamp(pd_date).is_week_end elif time_granularity is TimeGranularity.MONTH: return pd_date.is_month_end elif time_granularity is TimeGranularity.QUARTER: @@ -70,7 +70,7 @@ def period_begin_offset( # noqa: D if time_granularity is TimeGranularity.DAY: raise ValueError(f"Can't get period start offset for TimeGranularity.{time_granularity.name}.") elif time_granularity is TimeGranularity.WEEK: - return pd.offsets.Week(weekday=ISOWeekDay.MONDAY.pandas_value) + return pd.offsets.Week(dayofweek=ISODAYOFWEEK.MONDAY.pandas_value) elif time_granularity is TimeGranularity.MONTH: return pd.offsets.MonthBegin() elif time_granularity is TimeGranularity.QUARTER: @@ -87,7 +87,7 @@ def period_end_offset( # noqa: D if time_granularity is TimeGranularity.DAY: raise ValueError(f"Can't get period end offset for TimeGranularity.{time_granularity.name}.") elif time_granularity == TimeGranularity.WEEK: - return pd.offsets.Week(weekday=ISOWeekDay.SUNDAY.pandas_value) + return pd.offsets.Week(dayofweek=ISODAYOFWEEK.SUNDAY.pandas_value) elif time_granularity is TimeGranularity.MONTH: return pd.offsets.MonthEnd() elif time_granularity is TimeGranularity.QUARTER: @@ -132,7 +132,7 @@ def match_start_or_end_of_period( ) -class ISOWeekDay(ExtendedEnum): +class ISODAYOFWEEK(ExtendedEnum): """Day of week values per ISO standard.""" MONDAY = 1 @@ -144,23 +144,23 @@ class ISOWeekDay(ExtendedEnum): SUNDAY = 7 @staticmethod - def from_pandas_timestamp(timestamp: pd.Timestamp) -> ISOWeekDay: - """Factory for streamlining conversion from a Pandas Timestamp to an ISOWeekDay.""" - return ISOWeekDay(timestamp.isoweekday()) + def from_pandas_timestamp(timestamp: pd.Timestamp) -> ISODAYOFWEEK: + """Factory for streamlining conversion from a Pandas Timestamp to an ISODAYOFWEEK.""" + return ISODAYOFWEEK(timestamp.isodayofweek()) @property def is_week_start(self) -> bool: """Return comparison of instance value against ISO standard start of week (Monday).""" - return self is ISOWeekDay.MONDAY + return self is ISODAYOFWEEK.MONDAY @property def is_week_end(self) -> bool: """Return comparison of instance value against ISO standard end of week (Sunday).""" - return self is ISOWeekDay.SUNDAY + return self is ISODAYOFWEEK.SUNDAY @property def pandas_value(self) -> int: - """Returns the pandas int value representation of the ISOWeekDay.""" + """Returns the pandas int value representation of the ISODAYOFWEEK.""" return self.value - 1