From b566ef9ad45d33e7e261cdc253619a3366baed53 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Tue, 19 Sep 2023 11:47:57 -0700 Subject: [PATCH] Querying with DATE PART (#772) --- .../unreleased/Features-20230911-190924.yaml | 6 + metricflow/dag/id_generation.py | 1 + metricflow/dataset/convert_semantic_model.py | 48 +- metricflow/dataset/dataset.py | 8 +- metricflow/engine/metricflow_engine.py | 1 + metricflow/naming/linkable_spec_name.py | 39 +- metricflow/plan_conversion/column_resolver.py | 1 + metricflow/plan_conversion/dataflow_to_sql.py | 50 +- .../plan_conversion/instance_converters.py | 11 +- metricflow/query/query_parser.py | 139 +- metricflow/specs/query_interface.py | 12 + .../specs/query_param_implementations.py | 23 + metricflow/specs/specs.py | 5 + metricflow/specs/where_filter_dimension.py | 4 + .../specs/where_filter_time_dimension.py | 8 +- metricflow/sql/render/big_query.py | 12 + metricflow/sql/render/expr_renderer.py | 14 + metricflow/sql/sql_exprs.py | 64 + metricflow/test/conftest.py | 15 + .../dataset/test_convert_semantic_model.py | 211 ++ .../test/integration/configured_test_case.py | 3 +- .../integration/test_cases/itest_metrics.yaml | 74 + .../test/integration/test_configured_cases.py | 32 + .../test/model/test_data_warehouse_tasks.py | 4 +- .../test_dataflow_to_sql_plan.py | 82 + metricflow/test/query/test_query_parser.py | 71 +- ...st_convert_query_semantic_model__plan0.sql | 14 + ...le_semantic_model_with_measures__plan0.sql | 28 + ...semantic_model_without_measures__plan0.sql | 14 + ...st_convert_query_semantic_model__plan0.sql | 14 + ...le_semantic_model_with_measures__plan0.sql | 28 + ...semantic_model_without_measures__plan0.sql | 14 + ...st_convert_query_semantic_model__plan0.sql | 14 + ...le_semantic_model_with_measures__plan0.sql | 28 + ...semantic_model_without_measures__plan0.sql | 14 + ...st_convert_query_semantic_model__plan0.sql | 14 + ...le_semantic_model_with_measures__plan0.sql | 28 + ...semantic_model_without_measures__plan0.sql | 14 + ...st_convert_query_semantic_model__plan0.sql | 14 + ...le_semantic_model_with_measures__plan0.sql | 28 + ...semantic_model_without_measures__plan0.sql | 14 + ...st_convert_query_semantic_model__plan0.sql | 14 + ...le_semantic_model_with_measures__plan0.sql | 28 + ...semantic_model_without_measures__plan0.sql | 14 + .../test_common_semantic_model__dfp_0.xml | 4 + ...indow_or_grain_with_metric_time__dfp_0.xml | 1 + ...t_cumulative_metric_with_window__dfp_0.xml | 1 + ..._derived_metric_offset_to_grain__dfp_0.xml | 2 + ...st_derived_metric_offset_window__dfp_0.xml | 1 + ..._metric_offset_with_granularity__dfp_0.xml | 1 + ...erived_offset_cumulative_metric__dfp_0.xml | 1 + .../test_limit_rows_plan__dfp_0.xml | 1 + .../test_measure_constraint_plan__dfp_0.xml | 7 + ...traint_with_reused_measure_plan__dfp_0.xml | 3 + ...mantic_model_ratio_metrics_plan__dfp_0.xml | 4 + .../test_multihop_join_plan__dfp_0.xml | 162 +- .../test_multiple_metrics_plan__dfp_0.xml | 2 + .../test_order_by_plan__dfp_0.xml | 2 + ...mantic_model_ratio_metrics_plan__dfp_0.xml | 4 + ...constrained_plan_time_dimension__dfp_0.xml | 2 + ...spine_node_with_offset_to_grain__plan0.xml | 1 + ...e_spine_node_with_offset_window__plan0.xml | 1 + ..._time_spine_node_without_offset__plan0.xml | 1 + .../test_common_semantic_model__plan0.sql | 182 + .../test_compute_metrics_node__plan0.sql | 70 + ...o_from_multiple_semantic_models__plan0.sql | 280 ++ ...atio_from_single_semantic_model__plan0.sql | 70 + ...ompute_metrics_node_simple_expr__plan0.sql | 70 + .../test_constrain_time_range_node__plan0.sql | 42 + .../test_cumulative_metric__plan0.sql | 35 + ...cumulative_metric_grain_to_date__plan0.sql | 35 + .../test_cumulative_metric_no_ds__plan0.sql | 35 + ...est_cumulative_metric_no_window__plan0.sql | 35 + ..._no_window_with_time_constraint__plan0.sql | 56 + ...ive_metric_with_time_constraint__plan0.sql | 56 + .../BigQuery/test_derived_metric__plan0.sql | 182 + ...ved_metric_with_offset_to_grain__plan0.sql | 224 ++ ...offset_to_grain_and_granularity__plan0.sql | 224 ++ ...rived_metric_with_offset_window__plan0.sql | 224 ++ ...h_offset_window_and_granularity__plan0.sql | 224 ++ ...fset_window_and_offset_to_grain__plan0.sql | 266 ++ ...offset_to_grain_and_granularity__plan0.sql | 266 ++ ...erived_offset_cumulative_metric__plan0.sql | 182 + ...et_metric_with_one_input_metric__plan0.sql | 133 + .../BigQuery/test_distinct_values__plan0.sql | 154 + .../BigQuery/test_filter_node__plan0.sql | 42 + ...lter_with_where_constraint_node__plan0.sql | 42 + ...th_where_constraint_on_join_dim__plan0.sql | 154 + .../test_join_to_scd_dimension__plan0.sql | 119 + ...spine_node_with_offset_to_grain__plan0.sql | 91 + ...e_spine_node_with_offset_window__plan0.sql | 91 + ..._time_spine_node_without_offset__plan0.sql | 91 + .../BigQuery/test_limit_rows__plan0.sql | 91 + ...al_dimension_using_local_entity__plan0.sql | 63 + .../test_measure_aggregation_node__plan0.sql | 42 + .../test_measure_constraint__plan0.sql | 399 +++ ..._constraint_with_reused_measure__plan0.sql | 182 + ...aint_with_single_expr_and_alias__plan0.sql | 91 + ..._multiple_sources_no_dimensions__plan0.sql | 154 + ...multi_hop_through_scd_dimension__plan0.sql | 196 + ...test_multi_hop_to_scd_dimension__plan0.sql | 189 + .../BigQuery/test_multi_join_node__plan0.sql | 98 + .../BigQuery/test_multihop_node__plan0.sql | 140 + ..._multiple_metrics_no_dimensions__plan0.sql | 238 ++ .../test_nested_derived_metric__plan0.sql | 364 ++ ...st_offset_window_with_date_part__plan0.sql | 585 +++ ...window_with_date_part__plan0_optimized.sql | 63 + .../BigQuery/test_order_by_node__plan0.sql | 42 + .../BigQuery/test_partitioned_join__plan0.sql | 105 + .../test_semi_additive_join_node__plan0.sql | 42 + ...mi_additive_join_node__plan0_optimized.sql | 28 + ...dditive_join_node_with_grouping__plan0.sql | 42 + ...in_node_with_grouping__plan0_optimized.sql | 28 + ...join_node_with_queried_group_by__plan0.sql | 42 + ...with_queried_group_by__plan0_optimized.sql | 28 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + .../BigQuery/test_single_join_node__plan0.sql | 70 + .../BigQuery/test_source_node__plan0.sql | 42 + .../test_source_node__plan0_optimized.sql | 42 + .../test_common_semantic_model__plan0.sql | 182 + .../test_compute_metrics_node__plan0.sql | 70 + ...o_from_multiple_semantic_models__plan0.sql | 280 ++ ...atio_from_single_semantic_model__plan0.sql | 70 + ...ompute_metrics_node_simple_expr__plan0.sql | 70 + .../test_constrain_time_range_node__plan0.sql | 42 + .../test_cumulative_metric__plan0.sql | 35 + ...cumulative_metric_grain_to_date__plan0.sql | 35 + .../test_cumulative_metric_no_ds__plan0.sql | 35 + ...est_cumulative_metric_no_window__plan0.sql | 35 + ..._no_window_with_time_constraint__plan0.sql | 56 + ...ive_metric_with_time_constraint__plan0.sql | 56 + .../Databricks/test_derived_metric__plan0.sql | 182 + ...ved_metric_with_offset_to_grain__plan0.sql | 224 ++ ...offset_to_grain_and_granularity__plan0.sql | 224 ++ ...rived_metric_with_offset_window__plan0.sql | 224 ++ ...h_offset_window_and_granularity__plan0.sql | 224 ++ ...fset_window_and_offset_to_grain__plan0.sql | 266 ++ ...offset_to_grain_and_granularity__plan0.sql | 266 ++ ...erived_offset_cumulative_metric__plan0.sql | 182 + ...et_metric_with_one_input_metric__plan0.sql | 133 + .../test_distinct_values__plan0.sql | 154 + .../Databricks/test_filter_node__plan0.sql | 42 + ...lter_with_where_constraint_node__plan0.sql | 42 + ...th_where_constraint_on_join_dim__plan0.sql | 154 + .../test_join_to_scd_dimension__plan0.sql | 119 + ...spine_node_with_offset_to_grain__plan0.sql | 91 + ...e_spine_node_with_offset_window__plan0.sql | 91 + ..._time_spine_node_without_offset__plan0.sql | 91 + .../Databricks/test_limit_rows__plan0.sql | 91 + ...al_dimension_using_local_entity__plan0.sql | 63 + .../test_measure_aggregation_node__plan0.sql | 42 + .../test_measure_constraint__plan0.sql | 399 +++ ..._constraint_with_reused_measure__plan0.sql | 182 + ...aint_with_single_expr_and_alias__plan0.sql | 91 + ..._multiple_sources_no_dimensions__plan0.sql | 154 + ...multi_hop_through_scd_dimension__plan0.sql | 196 + ...test_multi_hop_to_scd_dimension__plan0.sql | 189 + .../test_multi_join_node__plan0.sql | 98 + .../Databricks/test_multihop_node__plan0.sql | 140 + ..._multiple_metrics_no_dimensions__plan0.sql | 238 ++ .../test_nested_derived_metric__plan0.sql | 364 ++ ...st_offset_window_with_date_part__plan0.sql | 585 +++ ...window_with_date_part__plan0_optimized.sql | 63 + .../Databricks/test_order_by_node__plan0.sql | 42 + .../test_partitioned_join__plan0.sql | 105 + .../test_semi_additive_join_node__plan0.sql | 42 + ...mi_additive_join_node__plan0_optimized.sql | 28 + ...dditive_join_node_with_grouping__plan0.sql | 42 + ...in_node_with_grouping__plan0_optimized.sql | 28 + ...join_node_with_queried_group_by__plan0.sql | 42 + ...with_queried_group_by__plan0_optimized.sql | 28 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + .../test_single_join_node__plan0.sql | 70 + .../Databricks/test_source_node__plan0.sql | 42 + .../test_source_node__plan0_optimized.sql | 42 + .../test_common_semantic_model__plan0.sql | 182 + .../test_compute_metrics_node__plan0.sql | 70 + ...o_from_multiple_semantic_models__plan0.sql | 280 ++ ...atio_from_single_semantic_model__plan0.sql | 70 + ...ompute_metrics_node_simple_expr__plan0.sql | 70 + .../test_constrain_time_range_node__plan0.sql | 42 + .../DuckDB/test_cumulative_metric__plan0.sql | 35 + ...cumulative_metric_grain_to_date__plan0.sql | 35 + .../test_cumulative_metric_no_ds__plan0.sql | 35 + ...est_cumulative_metric_no_window__plan0.sql | 35 + ..._no_window_with_time_constraint__plan0.sql | 56 + ...ive_metric_with_time_constraint__plan0.sql | 56 + .../DuckDB/test_derived_metric__plan0.sql | 182 + ...ved_metric_with_offset_to_grain__plan0.sql | 224 ++ ...offset_to_grain_and_granularity__plan0.sql | 224 ++ ...rived_metric_with_offset_window__plan0.sql | 224 ++ ...h_offset_window_and_granularity__plan0.sql | 224 ++ ...fset_window_and_offset_to_grain__plan0.sql | 266 ++ ...offset_to_grain_and_granularity__plan0.sql | 266 ++ ...erived_offset_cumulative_metric__plan0.sql | 182 + ...et_metric_with_one_input_metric__plan0.sql | 133 + .../DuckDB/test_distinct_values__plan0.sql | 154 + .../DuckDB/test_filter_node__plan0.sql | 42 + ...lter_with_where_constraint_node__plan0.sql | 42 + ...th_where_constraint_on_join_dim__plan0.sql | 154 + .../test_join_to_scd_dimension__plan0.sql | 119 + ...spine_node_with_offset_to_grain__plan0.sql | 91 + ...e_spine_node_with_offset_window__plan0.sql | 91 + ..._time_spine_node_without_offset__plan0.sql | 91 + .../DuckDB/test_limit_rows__plan0.sql | 91 + ...al_dimension_using_local_entity__plan0.sql | 63 + .../test_measure_aggregation_node__plan0.sql | 42 + .../DuckDB/test_measure_constraint__plan0.sql | 399 +++ ..._constraint_with_reused_measure__plan0.sql | 182 + ...aint_with_single_expr_and_alias__plan0.sql | 91 + ..._multiple_sources_no_dimensions__plan0.sql | 154 + ...multi_hop_through_scd_dimension__plan0.sql | 196 + ...test_multi_hop_to_scd_dimension__plan0.sql | 189 + .../DuckDB/test_multi_join_node__plan0.sql | 98 + .../DuckDB/test_multihop_node__plan0.sql | 140 + ..._multiple_metrics_no_dimensions__plan0.sql | 238 ++ .../test_nested_derived_metric__plan0.sql | 364 ++ ...st_offset_window_with_date_part__plan0.sql | 585 +++ ...window_with_date_part__plan0_optimized.sql | 63 + .../DuckDB/test_order_by_node__plan0.sql | 42 + .../DuckDB/test_partitioned_join__plan0.sql | 105 + .../test_semi_additive_join_node__plan0.sql | 42 + ...mi_additive_join_node__plan0_optimized.sql | 28 + ...dditive_join_node_with_grouping__plan0.sql | 42 + ...in_node_with_grouping__plan0_optimized.sql | 28 + ...join_node_with_queried_group_by__plan0.sql | 42 + ...with_queried_group_by__plan0_optimized.sql | 28 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + .../DuckDB/test_single_join_node__plan0.sql | 70 + .../DuckDB/test_source_node__plan0.sql | 42 + .../test_source_node__plan0_optimized.sql | 42 + .../test_common_semantic_model__plan0.sql | 182 + .../test_compute_metrics_node__plan0.sql | 70 + ...o_from_multiple_semantic_models__plan0.sql | 280 ++ ...atio_from_single_semantic_model__plan0.sql | 70 + ...ompute_metrics_node_simple_expr__plan0.sql | 70 + .../test_constrain_time_range_node__plan0.sql | 42 + .../test_cumulative_metric__plan0.sql | 35 + ...cumulative_metric_grain_to_date__plan0.sql | 35 + .../test_cumulative_metric_no_ds__plan0.sql | 35 + ...est_cumulative_metric_no_window__plan0.sql | 35 + ..._no_window_with_time_constraint__plan0.sql | 56 + ...ive_metric_with_time_constraint__plan0.sql | 56 + .../Postgres/test_derived_metric__plan0.sql | 182 + ...ved_metric_with_offset_to_grain__plan0.sql | 224 ++ ...offset_to_grain_and_granularity__plan0.sql | 224 ++ ...rived_metric_with_offset_window__plan0.sql | 224 ++ ...h_offset_window_and_granularity__plan0.sql | 224 ++ ...fset_window_and_offset_to_grain__plan0.sql | 266 ++ ...offset_to_grain_and_granularity__plan0.sql | 266 ++ ...erived_offset_cumulative_metric__plan0.sql | 182 + ...et_metric_with_one_input_metric__plan0.sql | 133 + .../Postgres/test_distinct_values__plan0.sql | 154 + .../Postgres/test_filter_node__plan0.sql | 42 + ...lter_with_where_constraint_node__plan0.sql | 42 + ...th_where_constraint_on_join_dim__plan0.sql | 154 + .../test_join_to_scd_dimension__plan0.sql | 119 + ...spine_node_with_offset_to_grain__plan0.sql | 91 + ...e_spine_node_with_offset_window__plan0.sql | 91 + ..._time_spine_node_without_offset__plan0.sql | 91 + .../Postgres/test_limit_rows__plan0.sql | 91 + ...al_dimension_using_local_entity__plan0.sql | 63 + .../test_measure_aggregation_node__plan0.sql | 42 + .../test_measure_constraint__plan0.sql | 399 +++ ..._constraint_with_reused_measure__plan0.sql | 182 + ...aint_with_single_expr_and_alias__plan0.sql | 91 + ..._multiple_sources_no_dimensions__plan0.sql | 154 + ...multi_hop_through_scd_dimension__plan0.sql | 196 + ...test_multi_hop_to_scd_dimension__plan0.sql | 189 + .../Postgres/test_multi_join_node__plan0.sql | 98 + .../Postgres/test_multihop_node__plan0.sql | 140 + ..._multiple_metrics_no_dimensions__plan0.sql | 238 ++ .../test_nested_derived_metric__plan0.sql | 364 ++ ...st_offset_window_with_date_part__plan0.sql | 585 +++ ...window_with_date_part__plan0_optimized.sql | 63 + .../Postgres/test_order_by_node__plan0.sql | 42 + .../Postgres/test_partitioned_join__plan0.sql | 105 + .../test_semi_additive_join_node__plan0.sql | 42 + ...mi_additive_join_node__plan0_optimized.sql | 28 + ...dditive_join_node_with_grouping__plan0.sql | 42 + ...in_node_with_grouping__plan0_optimized.sql | 28 + ...join_node_with_queried_group_by__plan0.sql | 42 + ...with_queried_group_by__plan0_optimized.sql | 28 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + .../Postgres/test_single_join_node__plan0.sql | 70 + .../Postgres/test_source_node__plan0.sql | 42 + .../test_source_node__plan0_optimized.sql | 42 + .../test_common_semantic_model__plan0.sql | 182 + .../test_compute_metrics_node__plan0.sql | 70 + ...o_from_multiple_semantic_models__plan0.sql | 280 ++ ...atio_from_single_semantic_model__plan0.sql | 70 + ...ompute_metrics_node_simple_expr__plan0.sql | 70 + .../test_constrain_time_range_node__plan0.sql | 42 + .../test_cumulative_metric__plan0.sql | 35 + ...cumulative_metric_grain_to_date__plan0.sql | 35 + .../test_cumulative_metric_no_ds__plan0.sql | 35 + ...est_cumulative_metric_no_window__plan0.sql | 35 + ..._no_window_with_time_constraint__plan0.sql | 56 + ...ive_metric_with_time_constraint__plan0.sql | 56 + .../Redshift/test_derived_metric__plan0.sql | 182 + ...ved_metric_with_offset_to_grain__plan0.sql | 224 ++ ...offset_to_grain_and_granularity__plan0.sql | 224 ++ ...rived_metric_with_offset_window__plan0.sql | 224 ++ ...h_offset_window_and_granularity__plan0.sql | 224 ++ ...fset_window_and_offset_to_grain__plan0.sql | 266 ++ ...offset_to_grain_and_granularity__plan0.sql | 266 ++ ...erived_offset_cumulative_metric__plan0.sql | 182 + ...et_metric_with_one_input_metric__plan0.sql | 133 + .../Redshift/test_distinct_values__plan0.sql | 154 + .../Redshift/test_filter_node__plan0.sql | 42 + ...lter_with_where_constraint_node__plan0.sql | 42 + ...th_where_constraint_on_join_dim__plan0.sql | 154 + .../test_join_to_scd_dimension__plan0.sql | 119 + ...spine_node_with_offset_to_grain__plan0.sql | 91 + ...e_spine_node_with_offset_window__plan0.sql | 91 + ..._time_spine_node_without_offset__plan0.sql | 91 + .../Redshift/test_limit_rows__plan0.sql | 91 + ...al_dimension_using_local_entity__plan0.sql | 63 + .../test_measure_aggregation_node__plan0.sql | 42 + .../test_measure_constraint__plan0.sql | 399 +++ ..._constraint_with_reused_measure__plan0.sql | 182 + ...aint_with_single_expr_and_alias__plan0.sql | 91 + ..._multiple_sources_no_dimensions__plan0.sql | 154 + ...multi_hop_through_scd_dimension__plan0.sql | 196 + ...test_multi_hop_to_scd_dimension__plan0.sql | 189 + .../Redshift/test_multi_join_node__plan0.sql | 98 + .../Redshift/test_multihop_node__plan0.sql | 140 + ..._multiple_metrics_no_dimensions__plan0.sql | 238 ++ .../test_nested_derived_metric__plan0.sql | 364 ++ ...st_offset_window_with_date_part__plan0.sql | 585 +++ ...window_with_date_part__plan0_optimized.sql | 63 + .../Redshift/test_order_by_node__plan0.sql | 42 + .../Redshift/test_partitioned_join__plan0.sql | 105 + .../test_semi_additive_join_node__plan0.sql | 42 + ...mi_additive_join_node__plan0_optimized.sql | 28 + ...dditive_join_node_with_grouping__plan0.sql | 42 + ...in_node_with_grouping__plan0_optimized.sql | 28 + ...join_node_with_queried_group_by__plan0.sql | 42 + ...with_queried_group_by__plan0_optimized.sql | 28 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + .../Redshift/test_single_join_node__plan0.sql | 70 + .../Redshift/test_source_node__plan0.sql | 42 + .../test_source_node__plan0_optimized.sql | 42 + .../test_common_semantic_model__plan0.sql | 182 + .../test_compute_metrics_node__plan0.sql | 70 + ...o_from_multiple_semantic_models__plan0.sql | 280 ++ ...atio_from_single_semantic_model__plan0.sql | 70 + ...ompute_metrics_node_simple_expr__plan0.sql | 70 + .../test_constrain_time_range_node__plan0.sql | 42 + .../test_cumulative_metric__plan0.sql | 35 + ...cumulative_metric_grain_to_date__plan0.sql | 35 + .../test_cumulative_metric_no_ds__plan0.sql | 35 + ...est_cumulative_metric_no_window__plan0.sql | 35 + ..._no_window_with_time_constraint__plan0.sql | 56 + ...ive_metric_with_time_constraint__plan0.sql | 56 + .../Snowflake/test_derived_metric__plan0.sql | 182 + ...ved_metric_with_offset_to_grain__plan0.sql | 224 ++ ...offset_to_grain_and_granularity__plan0.sql | 224 ++ ...rived_metric_with_offset_window__plan0.sql | 224 ++ ...h_offset_window_and_granularity__plan0.sql | 224 ++ ...fset_window_and_offset_to_grain__plan0.sql | 266 ++ ...offset_to_grain_and_granularity__plan0.sql | 266 ++ ...erived_offset_cumulative_metric__plan0.sql | 182 + ...et_metric_with_one_input_metric__plan0.sql | 133 + .../Snowflake/test_distinct_values__plan0.sql | 154 + .../Snowflake/test_filter_node__plan0.sql | 42 + ...lter_with_where_constraint_node__plan0.sql | 42 + ...th_where_constraint_on_join_dim__plan0.sql | 154 + .../test_join_to_scd_dimension__plan0.sql | 119 + ...spine_node_with_offset_to_grain__plan0.sql | 91 + ...e_spine_node_with_offset_window__plan0.sql | 91 + ..._time_spine_node_without_offset__plan0.sql | 91 + .../Snowflake/test_limit_rows__plan0.sql | 91 + ...al_dimension_using_local_entity__plan0.sql | 63 + .../test_measure_aggregation_node__plan0.sql | 42 + .../test_measure_constraint__plan0.sql | 399 +++ ..._constraint_with_reused_measure__plan0.sql | 182 + ...aint_with_single_expr_and_alias__plan0.sql | 91 + ..._multiple_sources_no_dimensions__plan0.sql | 154 + ...multi_hop_through_scd_dimension__plan0.sql | 196 + ...test_multi_hop_to_scd_dimension__plan0.sql | 189 + .../Snowflake/test_multi_join_node__plan0.sql | 98 + .../Snowflake/test_multihop_node__plan0.sql | 140 + ..._multiple_metrics_no_dimensions__plan0.sql | 238 ++ .../test_nested_derived_metric__plan0.sql | 364 ++ ...st_offset_window_with_date_part__plan0.sql | 585 +++ ...window_with_date_part__plan0_optimized.sql | 63 + .../Snowflake/test_order_by_node__plan0.sql | 42 + .../test_partitioned_join__plan0.sql | 105 + .../test_semi_additive_join_node__plan0.sql | 42 + ...mi_additive_join_node__plan0_optimized.sql | 28 + ...dditive_join_node_with_grouping__plan0.sql | 42 + ...in_node_with_grouping__plan0_optimized.sql | 28 + ...join_node_with_queried_group_by__plan0.sql | 42 + ...with_queried_group_by__plan0_optimized.sql | 28 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + .../test_single_join_node__plan0.sql | 70 + .../Snowflake/test_source_node__plan0.sql | 42 + .../test_source_node__plan0_optimized.sql | 42 + .../test_common_semantic_model__plan0.xml | 1404 ++++++-- .../test_compute_metrics_node__plan0.xml | 478 ++- ...o_from_multiple_semantic_models__plan0.xml | 2154 ++++++++--- ...atio_from_single_semantic_model__plan0.xml | 478 ++- ...ompute_metrics_node_simple_expr__plan0.xml | 478 ++- .../test_constrain_time_range_node__plan0.xml | 282 +- .../test_cumulative_metric__plan0.xml | 236 +- ...cumulative_metric_grain_to_date__plan0.xml | 236 +- .../test_cumulative_metric_no_ds__plan0.xml | 228 +- ...est_cumulative_metric_no_window__plan0.xml | 236 +- ..._no_window_with_time_constraint__plan0.xml | 380 +- ...ive_metric_with_time_constraint__plan0.xml | 380 +- .../test_derived_metric__plan0.xml | 1410 ++++++-- ...ved_metric_with_offset_to_grain__plan0.xml | 1774 ++++++--- ...offset_to_grain_and_granularity__plan0.xml | 1772 ++++++--- ...rived_metric_with_offset_window__plan0.xml | 1774 ++++++--- ...h_offset_window_and_granularity__plan0.xml | 1772 ++++++--- ...fset_window_and_offset_to_grain__plan0.xml | 2150 ++++++++--- ...offset_to_grain_and_granularity__plan0.xml | 2146 ++++++++--- ...erived_offset_cumulative_metric__plan0.xml | 1476 ++++++-- ...et_metric_with_one_input_metric__plan0.xml | 1068 ++++-- .../test_distinct_values__plan0.xml | 1188 ++++-- .../SqlQueryPlan/test_filter_node__plan0.xml | 282 +- ...lter_with_where_constraint_node__plan0.xml | 282 +- ...th_where_constraint_on_join_dim__plan0.xml | 1198 +++++-- .../test_join_to_scd_dimension__plan0.xml | 912 +++-- ...spine_node_with_offset_to_grain__plan0.xml | 682 +++- ...e_spine_node_with_offset_window__plan0.xml | 682 +++- ..._time_spine_node_without_offset__plan0.xml | 682 +++- .../SqlQueryPlan/test_limit_rows__plan0.xml | 706 +++- ...al_dimension_using_local_entity__plan0.xml | 478 ++- .../test_measure_aggregation_node__plan0.xml | 282 +- .../test_measure_constraint__plan0.xml | 3184 +++++++++++++---- ..._constraint_with_reused_measure__plan0.xml | 1422 ++++++-- ...aint_with_single_expr_and_alias__plan0.xml | 716 +++- ..._multiple_sources_no_dimensions__plan0.xml | 1168 ++++-- ...multi_hop_through_scd_dimension__plan0.xml | 1382 +++++-- ...test_multi_hop_to_scd_dimension__plan0.xml | 1246 +++++-- .../test_multi_join_node__plan0.xml | 670 +++- .../test_multihop_node__plan0.xml | 1058 ++++-- ..._multiple_metrics_no_dimensions__plan0.xml | 2200 ++++++++---- .../test_nested_derived_metric__plan0.xml | 2822 +++++++++++---- ...st_offset_window_with_date_part__plan0.xml | 2165 +++++++++++ .../test_order_by_node__plan0.xml | 282 +- .../test_partitioned_join__plan0.xml | 698 +++- .../test_semi_additive_join_node__plan0.xml | 246 +- ...dditive_join_node_with_grouping__plan0.xml | 246 +- ...join_node_with_queried_group_by__plan0.xml | 246 +- ...est_simple_query_with_date_part__plan0.xml | 863 +++++ ..._query_with_multiple_date_parts__plan0.xml | 966 +++++ .../test_single_join_node__plan0.xml | 478 ++- .../SqlQueryPlan/test_source_node__plan0.xml | 282 +- ...orm_node_using_non_primary_time__plan0.sql | 91 + ...sing_non_primary_time__plan0_optimized.sql | 49 + ...ansform_node_using_primary_time__plan0.sql | 91 + ...de_using_primary_time__plan0_optimized.sql | 49 + ...uery_with_metric_time_dimension__plan0.sql | 182 + ...orm_node_using_non_primary_time__plan0.sql | 91 + ...sing_non_primary_time__plan0_optimized.sql | 49 + ...ansform_node_using_primary_time__plan0.sql | 91 + ...de_using_primary_time__plan0_optimized.sql | 49 + ...uery_with_metric_time_dimension__plan0.sql | 182 + ...orm_node_using_non_primary_time__plan0.sql | 91 + ...sing_non_primary_time__plan0_optimized.sql | 49 + ...ansform_node_using_primary_time__plan0.sql | 91 + ...de_using_primary_time__plan0_optimized.sql | 49 + ...uery_with_metric_time_dimension__plan0.sql | 182 + ...orm_node_using_non_primary_time__plan0.sql | 91 + ...sing_non_primary_time__plan0_optimized.sql | 49 + ...ansform_node_using_primary_time__plan0.sql | 91 + ...de_using_primary_time__plan0_optimized.sql | 49 + ...uery_with_metric_time_dimension__plan0.sql | 182 + ...orm_node_using_non_primary_time__plan0.sql | 91 + ...sing_non_primary_time__plan0_optimized.sql | 49 + ...ansform_node_using_primary_time__plan0.sql | 91 + ...de_using_primary_time__plan0_optimized.sql | 49 + ...uery_with_metric_time_dimension__plan0.sql | 182 + ...orm_node_using_non_primary_time__plan0.sql | 91 + ...sing_non_primary_time__plan0_optimized.sql | 49 + ...ansform_node_using_primary_time__plan0.sql | 91 + ...de_using_primary_time__plan0_optimized.sql | 49 + ...uery_with_metric_time_dimension__plan0.sql | 182 + ...orm_node_using_non_primary_time__plan0.xml | 554 ++- ...ansform_node_using_primary_time__plan0.xml | 578 ++- ...uery_with_metric_time_dimension__plan0.xml | 1356 +++++-- .../test_joined_node_data_set__result0.txt | 21 + ...2_metrics_from_1_semantic_model__dfp_0.xml | 4 + ..._metrics_from_1_semantic_model__dfpo_0.xml | 2 + ..._metrics_from_2_semantic_models__dfp_0.xml | 2 + ...metrics_from_2_semantic_models__dfpo_0.xml | 2 + ...o_metrics_from_1_semantic_model__dfp_0.xml | 4 + ..._metrics_from_1_semantic_model__dfpo_0.xml | 1 + ..._metrics_from_2_semantic_models__dfp_0.xml | 3 + ...metrics_from_2_semantic_models__dfpo_0.xml | 2 + ...constrained_metric_not_combined__dfp_0.xml | 3 + ...onstrained_metric_not_combined__dfpo_0.xml | 3 + .../test_derived_metric__dfp_0.xml | 2 + .../test_derived_metric__dfpo_0.xml | 1 + ..._metric_with_non_derived_metric__dfp_0.xml | 3 + ...metric_with_non_derived_metric__dfpo_0.xml | 2 + .../test_nested_derived_metric__dfp_0.xml | 4 + .../test_nested_derived_metric__dfpo_0.xml | 2 + metricflow/test/sql/test_sql_expr_render.py | 9 + metricflow/time/date_part.py | 46 + metricflow/time/time_granularity_solver.py | 67 +- 522 files changed, 92551 insertions(+), 12143 deletions(-) create mode 100644 .changes/unreleased/Features-20230911-190924.yaml create mode 100644 metricflow/specs/query_param_implementations.py create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml create mode 100644 metricflow/time/date_part.py diff --git a/.changes/unreleased/Features-20230911-190924.yaml b/.changes/unreleased/Features-20230911-190924.yaml new file mode 100644 index 0000000000..85d9d36c35 --- /dev/null +++ b/.changes/unreleased/Features-20230911-190924.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Enable DATE PART aggregation for time dimensions +time: 2023-09-11T19:09:24.960342-07:00 +custom: + Author: courtneyholcomb + Issue: "770" 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/dataset/dataset.py b/metricflow/dataset/dataset.py index 38e25616a5..ea88d69b72 100644 --- a/metricflow/dataset/dataset.py +++ b/metricflow/dataset/dataset.py @@ -1,7 +1,7 @@ from __future__ import annotations import logging -from typing import Sequence +from typing import Optional, Sequence from dbt_semantic_interfaces.references import TimeDimensionReference from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity @@ -9,6 +9,7 @@ from metricflow.instances import InstanceSet, TimeDimensionInstance from metricflow.specs.specs import TimeDimensionSpec +from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -48,12 +49,15 @@ def metric_time_dimension_name() -> str: return DataSet.metric_time_dimension_reference().element_name @staticmethod - def metric_time_dimension_spec(time_granularity: TimeGranularity) -> TimeDimensionSpec: + def metric_time_dimension_spec( + time_granularity: TimeGranularity, date_part: Optional[DatePart] = None + ) -> TimeDimensionSpec: """Spec that corresponds to DataSet.metric_time_dimension_reference.""" return TimeDimensionSpec( element_name=DataSet.metric_time_dimension_reference().element_name, entity_links=(), time_granularity=time_granularity, + date_part=date_part, ) def __repr__(self) -> str: # noqa: D diff --git a/metricflow/engine/metricflow_engine.py b/metricflow/engine/metricflow_engine.py index 1d459bca78..af8aafc89a 100644 --- a/metricflow/engine/metricflow_engine.py +++ b/metricflow/engine/metricflow_engine.py @@ -456,6 +456,7 @@ def _create_execution_plan(self, mf_query_request: MetricFlowQueryRequest) -> Me query_spec = self._query_parser.parse_and_validate_query( metric_names=mf_query_request.metric_names, group_by_names=mf_query_request.group_by_names, + group_by=mf_query_request.group_by, limit=mf_query_request.limit, time_constraint_start=mf_query_request.time_constraint_start, time_constraint_end=mf_query_request.time_constraint_end, diff --git a/metricflow/naming/linkable_spec_name.py b/metricflow/naming/linkable_spec_name.py index 082f81cb84..e2eeed0d7c 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,10 +35,15 @@ 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]) + + for date_part in DatePart: + if name_parts[-1] == StructuredLinkableSpecName.date_part_suffix(date_part=date_part): + raise ValueError( + "Dunder syntax not supported for querying date_part. Use `group_by` object syntax instead." + ) associated_granularity = None - granularity: TimeGranularity for granularity in TimeGranularity: if name_parts[-1] == granularity.value: associated_granularity = granularity @@ -44,18 +52,30 @@ 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.""" + """Return the full name form. e.g. ds or listing__ds__month. + + If date_part is specified, don't include granularity in qualified_name since it will not impact the result. + """ 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) @@ -66,3 +86,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 27b6efe4e1..4391ad2254 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -88,6 +88,7 @@ SqlComparisonExpression, SqlDateTruncExpression, SqlExpressionNode, + SqlExtractExpression, SqlFunctionExpression, SqlLogicalExpression, SqlLogicalOperator, @@ -287,7 +288,8 @@ def visit_join_over_time_range_node(self, node: JoinOverTimeRangeNode) -> SqlDat metric_time_dimension_spec ).column_name - # assemble dataset with metric_time_dimension to join + # Assemble time_spine dataset with metric_time_dimension to join. + # Granularity of time_spine column should match granularity of metric_time column from parent dataset. assert metric_time_dimension_instance time_spine_data_set = self._make_time_spine_data_set( metric_time_dimension_instance=metric_time_dimension_instance, @@ -1119,7 +1121,8 @@ def visit_metric_time_dimension_transform_node(self, node: MetricTimeDimensionTr # For those matching time dimension instances, create the analog metric time dimension instances for the output. for matching_time_dimension_instance in matching_time_dimension_instances: metric_time_dimension_spec = DataSet.metric_time_dimension_spec( - matching_time_dimension_instance.spec.time_granularity + time_granularity=matching_time_dimension_instance.spec.time_granularity, + date_part=matching_time_dimension_instance.spec.date_part, ) metric_time_dimension_column_association = self._column_association_resolver.resolve_spec( metric_time_dimension_spec @@ -1134,6 +1137,7 @@ def visit_metric_time_dimension_transform_node(self, node: MetricTimeDimensionTr 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, @@ -1345,38 +1349,25 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode) -> SqlDataSet len(time_spine_dataset.instance_set.time_dimension_instances) == 1 and len(time_spine_dataset.sql_select_node.select_columns) == 1 ), "Time spine dataset not configured properly. Expected exactly one column." - original_time_dim_instance = time_spine_dataset.instance_set.time_dimension_instances[0] + time_dim_instance = time_spine_dataset.instance_set.time_dimension_instances[0] time_spine_column_select_expr: Union[ SqlColumnReferenceExpression, SqlDateTruncExpression ] = SqlColumnReferenceExpression( - SqlColumnReference(table_alias=time_spine_alias, column_name=original_time_dim_instance.spec.qualified_name) + SqlColumnReference(table_alias=time_spine_alias, column_name=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 for metric_time_dimension_spec in node.metric_time_dimension_specs: + # Apply granularity to SQL. if metric_time_dimension_spec.time_granularity == self._time_spine_source.time_column_granularity: - select_expr = time_spine_column_select_expr - time_dim_instance = original_time_dim_instance - column_alias = original_time_dim_instance.associated_column.column_name + select_expr: SqlExpressionNode = time_spine_column_select_expr else: select_expr = SqlDateTruncExpression( time_granularity=metric_time_dimension_spec.time_granularity, arg=time_spine_column_select_expr ) - new_time_dim_spec = TimeDimensionSpec( - 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, - aggregation_state=original_time_dim_instance.spec.aggregation_state, - ) - time_dim_instance = TimeDimensionInstance( - defined_from=original_time_dim_instance.defined_from, - associated_columns=(self._column_association_resolver.resolve_spec(new_time_dim_spec),), - spec=new_time_dim_spec, - ) - column_alias = time_dim_instance.associated_column.column_name if node.offset_to_grain: # Filter down to one row per granularity period new_filter = SqlComparisonExpression( @@ -1386,8 +1377,25 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode) -> SqlDataSet where = new_filter else: where = SqlLogicalExpression(operator=SqlLogicalOperator.OR, args=(where, new_filter)) + # Apply date_part to SQL. + if metric_time_dimension_spec.date_part: + select_expr = SqlExtractExpression(date_part=metric_time_dimension_spec.date_part, arg=select_expr) + time_dim_spec = TimeDimensionSpec( + element_name=time_dim_instance.spec.element_name, + entity_links=time_dim_instance.spec.entity_links, + time_granularity=metric_time_dimension_spec.time_granularity, + date_part=metric_time_dimension_spec.date_part, + aggregation_state=time_dim_instance.spec.aggregation_state, + ) + time_dim_instance = TimeDimensionInstance( + defined_from=time_dim_instance.defined_from, + associated_columns=(self._column_association_resolver.resolve_spec(time_dim_spec),), + spec=time_dim_spec, + ) metric_time_dimension_instances.append(time_dim_instance) - metric_time_select_columns.append(SqlSelectColumn(expr=select_expr, column_alias=column_alias)) + metric_time_select_columns.append( + SqlSelectColumn(expr=select_expr, column_alias=time_dim_instance.associated_column.column_name) + ) metric_time_instance_set = InstanceSet(time_dimension_instances=tuple(metric_time_dimension_instances)) return SqlDataSet( diff --git a/metricflow/plan_conversion/instance_converters.py b/metricflow/plan_conversion/instance_converters.py index 0620598c8d..07bf4922f1 100644 --- a/metricflow/plan_conversion/instance_converters.py +++ b/metricflow/plan_conversion/instance_converters.py @@ -47,6 +47,7 @@ SqlFunctionExpression, ) from metricflow.sql.sql_plan import SqlSelectColumn +from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -262,6 +263,7 @@ class _DimensionValidityParams: dimension_name: str time_granularity: TimeGranularity + date_part: Optional[DatePart] = None class CreateValidityWindowJoinDescription(InstanceSetTransform[Optional[ValidityWindowJoinDescription]]): @@ -324,12 +326,16 @@ def transform(self, instance_set: InstanceSet) -> Optional[ValidityWindowJoinDes start_specs = [ spec for spec in specs - if spec.element_name == start_dim.dimension_name and spec.time_granularity == start_dim.time_granularity + if spec.element_name == start_dim.dimension_name + and spec.time_granularity == start_dim.time_granularity + and spec.date_part == start_dim.date_part ] end_specs = [ spec for spec in specs - if spec.element_name == end_dim.dimension_name and spec.time_granularity == end_dim.time_granularity + if spec.element_name == end_dim.dimension_name + and spec.time_granularity == end_dim.time_granularity + and spec.date_part == end_dim.date_part ] linkless_start_specs = {spec.without_entity_links for spec in start_specs} linkless_end_specs = {spec.without_entity_links for spec in end_specs} @@ -401,6 +407,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/query/query_parser.py b/metricflow/query/query_parser.py index 0027e68322..b1ec546c71 100644 --- a/metricflow/query/query_parser.py +++ b/metricflow/query/query_parser.py @@ -289,20 +289,6 @@ def _construct_metric_specs_for_query( ) return tuple(metric_specs) - def _get_group_by_names( - self, group_by_names: Optional[Sequence[str]], group_by: Optional[Sequence[QueryParameter]] - ) -> Sequence[str]: - assert not ( - group_by_names and group_by - ), "Both group_by_names and group_by were set, but if a group by is specified you should only use one of these!" - return ( - group_by_names - if group_by_names - else [f"{g.name}__{g.grain}" if g.grain else g.name for g in group_by] - if group_by - else [] - ) - def _get_metric_names( self, metric_names: Optional[Sequence[str]], metrics: Optional[Sequence[QueryInterfaceMetric]] ) -> Sequence[str]: @@ -343,7 +329,6 @@ def _parse_and_validate_query( time_granularity: Optional[TimeGranularity] = None, ) -> MetricFlowQuerySpec: metric_names = self._get_metric_names(metric_names, metrics) - group_by_names = self._get_group_by_names(group_by_names, group_by) where_filter = self._get_where_filter(where_constraint, where_constraint_str) order = self._get_order(order, order_by) @@ -393,7 +378,9 @@ def _parse_and_validate_query( # If the time constraint is all time, just ignore and not render time_constraint = None - requested_linkable_specs = self._parse_linkable_element_names(group_by_names, metric_references) + requested_linkable_specs = self._parse_linkable_elements( + qualified_linkable_names=group_by_names, linkable_elements=group_by, metric_references=metric_references + ) where_filter_spec: Optional[WhereFilterSpec] = None if where_filter is not None: try: @@ -427,6 +414,7 @@ def _parse_and_validate_query( self._validate_no_time_dimension_query(metric_references=metric_references) self._time_granularity_solver.validate_time_granularity(metric_references, time_dimension_specs) + self._validate_date_part(metric_references, time_dimension_specs) order_by_specs = self._parse_order_by(order or [], partial_time_dimension_spec_replacements) @@ -436,8 +424,9 @@ def _parse_and_validate_query( for metric_reference in metric_references: metric = self._metric_lookup.get_metric(metric_reference) if metric.filter is not None: - group_by_specs_for_one_metric = self._parse_linkable_element_names( + group_by_specs_for_one_metric = self._parse_linkable_elements( qualified_linkable_names=group_by_names, + linkable_elements=group_by, metric_references=(metric_reference,), ) @@ -529,6 +518,35 @@ def _validate_order_by_specs( ): raise InvalidQueryException(f"Order by item {order_by_spec} not in the query") + def _validate_date_part( + self, metric_references: Sequence[MetricReference], time_dimension_specs: Sequence[TimeDimensionSpec] + ) -> None: + """Validate that date parts can be used for metrics. + + TODO: figure out expected behavior for date part with these types of metrics. + """ + date_part_requested = False + for time_dimension_spec in time_dimension_specs: + if time_dimension_spec.date_part: + date_part_requested = True + if time_dimension_spec.date_part.to_int() < time_dimension_spec.time_granularity.to_int(): + raise RequestTimeGranularityException( + f"Date part {time_dimension_spec.date_part.name} is not compatible with time granularity " + f"{time_dimension_spec.time_granularity.name}. Compatible granularities include: " + f"{[granularity.name for granularity in time_dimension_spec.date_part.compatible_granularities]}" + ) + if date_part_requested: + for metric_reference in metric_references: + metric = self._metric_lookup.get_metric(metric_reference) + if metric.type == MetricType.CUMULATIVE: + raise UnableToSatisfyQueryError("Cannot extract date part for cumulative metrics.") + elif metric.type == MetricType.DERIVED: + for input_metric in metric.type_params.metrics or []: + if input_metric.offset_to_grain: + raise UnableToSatisfyQueryError( + "Cannot extract date part for metrics with offset_to_grain." + ) + def _adjust_time_range_constraint( self, metric_references: Sequence[MetricReference], @@ -643,26 +661,44 @@ def _parse_metric_names( metric_references.extend(list(input_metrics)) return tuple(metric_references) - def _parse_linkable_element_names( + def _parse_linkable_elements( self, - qualified_linkable_names: Sequence[str], metric_references: Sequence[MetricReference], + qualified_linkable_names: Optional[Sequence[str]] = None, + linkable_elements: Optional[Sequence[QueryParameter]] = None, ) -> QueryTimeLinkableSpecSet: """Convert the linkable spec names into the respective specification objects.""" - qualified_linkable_names = [x.lower() for x in qualified_linkable_names] + # TODO: refactor to only support group_by object inputs (removing group_by_names param) + assert not ( + qualified_linkable_names and linkable_elements + ), "Both group_by_names and group_by were set, but if a group by is specified you should only use one of these!" + + structured_names: List[StructuredLinkableSpecName] = [] + if qualified_linkable_names: + qualified_linkable_names = [x.lower() for x in qualified_linkable_names] + structured_names = [StructuredLinkableSpecName.from_name(name) for name in qualified_linkable_names] + elif linkable_elements: + for linkable_element in linkable_elements: + parsed_name = StructuredLinkableSpecName.from_name(linkable_element.name) + structured_name = StructuredLinkableSpecName( + entity_link_names=parsed_name.entity_link_names, + element_name=parsed_name.element_name, + time_granularity=linkable_element.grain, + date_part=linkable_element.date_part, + ) + structured_names.append(structured_name) dimension_specs = [] time_dimension_specs = [] partial_time_dimension_specs = [] entity_specs = [] - for qualified_name in qualified_linkable_names: - structured_name = StructuredLinkableSpecName.from_name(qualified_name) + for structured_name in structured_names: element_name = structured_name.element_name entity_links = tuple(EntityReference(element_name=x) for x in structured_name.entity_link_names) # Create the spec based on the type of element referenced. if TimeDimensionReference(element_name=element_name) in self._known_time_dimension_element_references: - if structured_name.time_granularity: + if structured_name.time_granularity and not structured_name.date_part: time_dimension_specs.append( TimeDimensionSpec( element_name=element_name, @@ -671,31 +707,47 @@ def _parse_linkable_element_names( ) ) else: - partial_time_dimension_specs.append( - PartialTimeDimensionSpec( - element_name=element_name, - entity_links=entity_links, - ) + partial_time_dimension_spec = PartialTimeDimensionSpec( + element_name=element_name, entity_links=entity_links, date_part=structured_name.date_part ) + # If both granularity & date_part are requested, verify requested & resolved granularities match. + if structured_name.time_granularity and structured_name.date_part: + self._verify_resolved_granularity_for_date_part( + requested_dimension_structured_name=structured_name, + partial_time_dimension_spec=partial_time_dimension_spec, + metric_references=metric_references, + ) + partial_time_dimension_specs.append(partial_time_dimension_spec) + elif DimensionReference(element_name=element_name) in self._known_dimension_element_references: dimension_specs.append(DimensionSpec(element_name=element_name, entity_links=entity_links)) elif EntityReference(element_name=element_name) in self._known_entity_element_references: entity_specs.append(EntitySpec(element_name=element_name, entity_links=entity_links)) else: + valid_group_bys_for_metrics = self._metric_lookup.element_specs_for_metrics(list(metric_references)) valid_group_by_names_for_metrics = sorted( - x.qualified_name for x in self._metric_lookup.element_specs_for_metrics(list(metric_references)) + list( + set( + x.qualified_name if qualified_linkable_names else x.element_name + for x in valid_group_bys_for_metrics + ) + ) ) + # If requested by name, show qualified name. If requested as object, show element name. + display_name = structured_name.qualified_name if qualified_linkable_names else element_name suggestions = { - f"Suggestions for '{qualified_name}'": pformat_big_objects( + f"Suggestions for '{display_name}'": pformat_big_objects( MetricFlowQueryParser._top_fuzzy_matches( - item=qualified_name, + item=display_name, candidate_items=valid_group_by_names_for_metrics, ) ) } raise UnableToSatisfyQueryError( - f"Unknown element name '{element_name}' in dimension name '{qualified_name}'", + f"Unknown element name '{element_name}' in dimension name '{display_name}'" + if qualified_linkable_names + else f"Unknown dimension {element_name}", context=suggestions, ) @@ -706,6 +758,28 @@ def _parse_linkable_element_names( entity_specs=tuple(entity_specs), ) + def _verify_resolved_granularity_for_date_part( + self, + requested_dimension_structured_name: StructuredLinkableSpecName, + partial_time_dimension_spec: PartialTimeDimensionSpec, + metric_references: Sequence[MetricReference], + ) -> None: + """Enforce that any granularity value associated with a date part query is the minimum. + + By default, we will always ensure that a date_part query request uses the minimum granularity. + However, there are some interfaces where the user must pass in a granularity, so we need a check to + ensure that the correct value was passed in. + """ + resolved_granularity = self._time_granularity_solver.find_minimum_granularity_for_partial_time_dimension_spec( + partial_time_dimension_spec=partial_time_dimension_spec, metric_references=metric_references + ) + if resolved_granularity != requested_dimension_structured_name.time_granularity: + raise RequestTimeGranularityException( + f"When applying a date part to dimension '{requested_dimension_structured_name.qualified_name}' with " + f"metrics {[metric.element_name for metric in metric_references]}, only {resolved_granularity.name} " + "granularity can be used." + ) + def _get_invalid_linkable_specs( self, metric_references: Tuple[MetricReference, ...], @@ -795,6 +869,7 @@ def _parse_order_by( element_name=parsed_name.element_name, entity_links=entity_links, time_granularity=parsed_name.time_granularity, + date_part=parsed_name.date_part, ), descending=descending, ) diff --git a/metricflow/specs/query_interface.py b/metricflow/specs/query_interface.py index ee55a52086..1939c7dbe2 100644 --- a/metricflow/specs/query_interface.py +++ b/metricflow/specs/query_interface.py @@ -4,6 +4,8 @@ from dbt_semantic_interfaces.type_enums import TimeGranularity +from metricflow.time.date_part import DatePart + class QueryInterfaceMetric(Protocol): """Metric in the query interface.""" @@ -27,6 +29,11 @@ def grain(self) -> Optional[TimeGranularity]: """The time granularity.""" raise NotImplementedError + @property + def date_part(self) -> Optional[DatePart]: + """Date part to extract from the dimension.""" + raise NotImplementedError + class QueryInterfaceDimension(Protocol): """Represents the interface for Dimension in the query interface.""" @@ -39,6 +46,10 @@ def alias(self, _alias: str) -> QueryInterfaceDimension: """Renaming the column.""" raise NotImplementedError + def date_part(self, _date_part: str) -> QueryInterfaceDimension: + """Date part to extract from the dimension.""" + raise NotImplementedError + class QueryInterfaceDimensionFactory(Protocol): """Creates a Dimension for the query interface. @@ -67,6 +78,7 @@ def create( self, time_dimension_name: str, time_granularity_name: str, + date_part_name: Optional[str] = None, entity_path: Sequence[str] = (), ) -> QueryInterfaceTimeDimension: """Create a TimeDimension.""" diff --git a/metricflow/specs/query_param_implementations.py b/metricflow/specs/query_param_implementations.py new file mode 100644 index 0000000000..62c42d6937 --- /dev/null +++ b/metricflow/specs/query_param_implementations.py @@ -0,0 +1,23 @@ +from __future__ import annotations + +from dataclasses import dataclass +from typing import Optional + +from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity + +from metricflow.naming.linkable_spec_name import StructuredLinkableSpecName +from metricflow.time.date_part import DatePart + + +@dataclass(frozen=True) +class DimensionQueryParameter: + """Time dimension requested in a query.""" + + name: str + grain: Optional[TimeGranularity] = None + date_part: Optional[DatePart] = None + + def __post_init__(self) -> None: # noqa: D + parsed_name = StructuredLinkableSpecName.from_name(self.name) + if parsed_name.time_granularity: + raise ValueError("Must use object syntax for `grain` parameter if `date_part` is requested.") diff --git a/metricflow/specs/specs.py b/metricflow/specs/specs.py index 46e071a30b..81e1f68e23 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 @@ -324,6 +327,7 @@ def qualified_name(self) -> str: # noqa: D entity_link_names=tuple(x.element_name for x in self.entity_links), element_name=self.element_name, time_granularity=self.time_granularity, + date_part=self.date_part, ).qualified_name @property @@ -338,6 +342,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_dimension.py b/metricflow/specs/where_filter_dimension.py index 3f33f87d96..d37fec3f8b 100644 --- a/metricflow/specs/where_filter_dimension.py +++ b/metricflow/specs/where_filter_dimension.py @@ -36,6 +36,10 @@ def grain(self, _grain: str) -> QueryInterfaceDimension: """The time granularity.""" raise NotImplementedError + def date_part(self, _date_part: str) -> QueryInterfaceDimension: + """The date_part requested to extract.""" + raise NotImplementedError + def alias(self, _alias: str) -> QueryInterfaceDimension: """Renaming the column.""" raise NotImplementedError diff --git a/metricflow/specs/where_filter_time_dimension.py b/metricflow/specs/where_filter_time_dimension.py index 9ad0bb1826..3b24a9017e 100644 --- a/metricflow/specs/where_filter_time_dimension.py +++ b/metricflow/specs/where_filter_time_dimension.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import List, Sequence +from typing import List, Optional, Sequence from dbt_semantic_interfaces.call_parameter_sets import FilterCallParameterSets, TimeDimensionCallParameterSet from dbt_semantic_interfaces.naming.dundered import DunderedNameFormatter @@ -52,7 +52,11 @@ def __init__( # noqa self.time_dimension_specs: List[TimeDimensionSpec] = [] def create( - self, time_dimension_name: str, time_granularity_name: str, entity_path: Sequence[str] = () + self, + time_dimension_name: str, + time_granularity_name: str, + date_part_name: Optional[str] = None, + entity_path: Sequence[str] = (), ) -> WhereFilterTimeDimension: """Create a WhereFilterTimeDimension.""" structured_name = DunderedNameFormatter.parse_name(time_dimension_name) diff --git a/metricflow/sql/render/big_query.py b/metricflow/sql/render/big_query.py index f5c15a2ab6..4dcb42aaa3 100644 --- a/metricflow/sql/render/big_query.py +++ b/metricflow/sql/render/big_query.py @@ -24,6 +24,7 @@ SqlTimeDeltaExpression, ) from metricflow.sql.sql_plan import SqlSelectColumn +from metricflow.time.date_part import DatePart class BigQuerySqlExpressionRenderer(DefaultSqlExpressionRenderer): @@ -129,6 +130,17 @@ def visit_date_trunc_expr(self, node: SqlDateTruncExpression) -> SqlExpressionRe bind_parameters=arg_rendered.bind_parameters, ) + @override + def render_date_part(self, date_part: DatePart) -> str: + if date_part == DatePart.DOY: + return "dayofyear" + if date_part == DatePart.DOW: + return "dayofweek" + if date_part == DatePart.WEEK: + return "isoweek" + + return super().render_date_part(date_part) + @override def visit_time_delta_expr(self, node: SqlTimeDeltaExpression) -> SqlExpressionRenderResult: """Render time delta for BigQuery, which requires ISO prefixing for the WEEK granularity value.""" diff --git a/metricflow/sql/render/expr_renderer.py b/metricflow/sql/render/expr_renderer.py index 26a4e0065c..9a5e58a465 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.value + 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/conftest.py b/metricflow/test/conftest.py index 31cb6d558e..13318c9f16 100644 --- a/metricflow/test/conftest.py +++ b/metricflow/test/conftest.py @@ -1,6 +1,11 @@ # These imports are required to properly set up pytest fixtures. from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity + from metricflow.test.fixtures.cli_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.dataflow_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.id_fixtures import * # noqa: F401, F403 @@ -9,3 +14,13 @@ from metricflow.test.fixtures.sql_client_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.sql_fixtures import * # noqa: F401, F403 from metricflow.test.fixtures.table_fixtures import * # noqa: F401, F403 +from metricflow.time.date_part import DatePart + + +@dataclass +class MockQueryParameter: + """This is a mock that is just used to test the query parser.""" + + name: str + grain: Optional[TimeGranularity] = None + date_part: Optional[DatePart] = None diff --git a/metricflow/test/dataset/test_convert_semantic_model.py b/metricflow/test/dataset/test_convert_semantic_model.py index 3335742f2a..747510ff6e 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.DOW + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY + ), 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.DOW, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="user"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DOY, + ), ), ) @@ -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.DOW + ), + TimeDimensionSpec( + element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY + ), 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.DOW, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DOY, + ), 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.DOW, + ), + TimeDimensionSpec( + element_name="ds", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DOY, + ), 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.DOW, + ), + TimeDimensionSpec( + element_name="ds_partitioned", + entity_links=(EntityReference(element_name="verification"),), + time_granularity=TimeGranularity.DAY, + date_part=DatePart.DOY, + ), ), ) diff --git a/metricflow/test/integration/configured_test_case.py b/metricflow/test/integration/configured_test_case.py index a6c0ac8e20..766873b9b0 100644 --- a/metricflow/test/integration/configured_test_case.py +++ b/metricflow/test/integration/configured_test_case.py @@ -4,7 +4,7 @@ import os from collections import OrderedDict from enum import Enum -from typing import Optional, Sequence, Tuple +from typing import Dict, Optional, Sequence, Tuple import yaml from dbt_semantic_interfaces.implementations.base import FrozenBaseModel @@ -53,6 +53,7 @@ class Config: # noqa: D check_query: str file_path: str group_bys: Tuple[str, ...] = () + group_by_objs: Tuple[Dict, ...] = () order_bys: Tuple[str, ...] = () # The required features in the DW engine for the test to complete. required_features: Tuple[RequiredDwEngineFeatures, ...] = () diff --git a/metricflow/test/integration/test_cases/itest_metrics.yaml b/metricflow/test/integration/test_cases/itest_metrics.yaml index 856b591781..d88ed9d83c 100644 --- a/metricflow/test/integration/test_cases/itest_metrics.yaml +++ b/metricflow/test/integration/test_cases/itest_metrics.yaml @@ -1043,3 +1043,77 @@ integration_test: ) b ON a.metric_time__week = b.metric_time__week AND a.metric_time__month = b.metric_time__month +--- +integration_test: + name: simple_query_with_date_part + description: Test query using date_part + model: SIMPLE_MODEL + metrics: ["bookings"] + group_by_objs: [{"name": "metric_time", "date_part": "year"}] + check_query: | + SELECT + SUM(1) AS bookings + , {{ render_extract("ds", DatePart.YEAR) }} AS metric_time__extract_year + FROM {{ source_schema }}.fct_bookings + GROUP BY {{ render_extract("ds", DatePart.YEAR) }}; +--- +integration_test: + name: simple_query_with_multiple_date_parts + description: Test query using multiple date_parts + model: SIMPLE_MODEL + metrics: ["bookings"] + group_by_objs: [ + {"name": "metric_time", "date_part": "quarter"}, + {"name": "metric_time", "date_part": "dow"}, + {"name": "metric_time", "date_part": "doy"}, + {"name": "metric_time", "date_part": "day"}, + {"name": "metric_time", "date_part": "week"}, + ] + check_query: | + SELECT + SUM(1) AS bookings + , {{ render_extract("ds", DatePart.QUARTER) }} AS metric_time__extract_quarter + , {{ render_extract("ds", DatePart.DOW) }} AS metric_time__extract_dow + , {{ render_extract("ds", DatePart.DOY) }} AS metric_time__extract_doy + , {{ render_extract("ds", DatePart.DAY) }} AS metric_time__extract_day + , {{ render_extract("ds", DatePart.WEEK) }} AS metric_time__extract_week + FROM {{ source_schema }}.fct_bookings + GROUP BY + {{ render_extract("ds", DatePart.QUARTER) }} + , {{ render_extract("ds", DatePart.DOW) }} + , {{ render_extract("ds", DatePart.DOY) }} + , {{ render_extract("ds", DatePart.DAY) }} + , {{ render_extract("ds", DatePart.WEEK) }}; +--- +integration_test: + name: derived_metric_offset_window_and_date_part + description: Tests a derived metric offset query with window and date_part + model: SIMPLE_MODEL + metrics: ["bookings_5_day_lag"] + group_by_objs: [{"name": "metric_time", "date_part": "month"}] + check_query: | + SELECT + {{ render_extract("a.ds", DatePart.MONTH) }} AS metric_time__extract_month + , SUM(b.bookings_5_day_lag) AS bookings_5_day_lag + FROM {{ mf_time_spine_source }} a + INNER JOIN ( + SELECT + ds AS metric_time__day + , 1 AS bookings_5_day_lag + FROM {{ source_schema }}.fct_bookings + ) b + ON {{ render_date_sub("a", "ds", 5, TimeGranularity.DAY) }} = b.metric_time__day + GROUP BY metric_time__extract_month +--- +integration_test: + name: simple_distinct_query_with_date_part + description: Test count distinct query using date_part + model: SIMPLE_MODEL + metrics: ["bookers"] + group_by_objs: [{"name": "metric_time", "date_part": "dow"}] + check_query: | + SELECT + COUNT(DISTINCT guest_id) AS bookers + , {{ render_extract("ds", DatePart.DOW) }} AS metric_time__extract_dow + FROM {{ source_schema }}.fct_bookings + GROUP BY {{ render_extract("ds", DatePart.DOW) }}; diff --git a/metricflow/test/integration/test_configured_cases.py b/metricflow/test/integration/test_configured_cases.py index 12b6aac0f3..af897edcaa 100644 --- a/metricflow/test/integration/test_configured_cases.py +++ b/metricflow/test/integration/test_configured_cases.py @@ -2,6 +2,7 @@ import datetime import logging +from copy import copy from typing import List, Optional, Sequence, Tuple import jinja2 @@ -18,11 +19,13 @@ DunderColumnAssociationResolver, ) from metricflow.protocols.sql_client import SqlClient +from metricflow.specs.query_param_implementations import DimensionQueryParameter from metricflow.sql.sql_exprs import ( SqlCastToTimestampExpression, SqlColumnReference, SqlColumnReferenceExpression, SqlDateTruncExpression, + SqlExtractExpression, SqlPercentileExpression, SqlPercentileExpressionArgument, SqlPercentileFunctionType, @@ -39,6 +42,7 @@ from metricflow.test.time.configurable_time_source import ( ConfigurableTimeSource, ) +from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -100,6 +104,19 @@ def render_date_trunc(self, expr: str, granularity: TimeGranularity) -> str: ) return self._sql_client.sql_query_plan_renderer.expr_renderer.render_sql_expr(renderable_expr).sql + def render_extract(self, expr: str, date_part: DatePart) -> str: + """Return the EXTRACT call that can be used for converting the given expr to the date_part.""" + renderable_expr = SqlExtractExpression( + date_part=date_part, + arg=SqlCastToTimestampExpression( + arg=SqlStringExpression( + sql_expr=expr, + requires_parenthesis=False, + ) + ), + ) + return self._sql_client.sql_query_plan_renderer.expr_renderer.render_sql_expr(renderable_expr).sql + def render_percentile_expr( self, expr: str, percentile: float, use_discrete_percentile: bool, use_approximate_percentile: bool ) -> str: @@ -238,10 +255,21 @@ def test_case( check_query_helpers = CheckQueryHelpers(sql_client) + group_by: List[DimensionQueryParameter] = [] + for group_by_kwargs in case.group_by_objs: + kwargs = copy(group_by_kwargs) + date_part = kwargs.get("date_part") + grain = kwargs.get("grain") + if date_part: + kwargs["date_part"] = DatePart(date_part) + if grain: + kwargs["grain"] = TimeGranularity(grain) + group_by.append(DimensionQueryParameter(**kwargs)) query_result = engine.query( MetricFlowQueryRequest.create_with_random_request_id( metric_names=case.metrics, group_by_names=case.group_bys, + group_by=tuple(group_by), limit=case.limit, time_constraint_start=parser.parse(case.time_constraint[0]) if case.time_constraint else None, time_constraint_end=parser.parse(case.time_constraint[1]) if case.time_constraint else None, @@ -252,8 +280,10 @@ def test_case( source_schema=mf_test_session_state.mf_source_schema, render_time_constraint=check_query_helpers.render_time_constraint, TimeGranularity=TimeGranularity, + DatePart=DatePart, render_date_sub=check_query_helpers.render_date_sub, render_date_trunc=check_query_helpers.render_date_trunc, + render_extract=check_query_helpers.render_extract, render_percentile_expr=check_query_helpers.render_percentile_expr, mf_time_spine_source=semantic_manifest_lookup.time_spine_source.spine_table.sql, double_data_type_name=check_query_helpers.double_data_type_name, @@ -277,8 +307,10 @@ def test_case( source_schema=mf_test_session_state.mf_source_schema, render_time_constraint=check_query_helpers.render_time_constraint, TimeGranularity=TimeGranularity, + DatePart=DatePart, render_date_sub=check_query_helpers.render_date_sub, render_date_trunc=check_query_helpers.render_date_trunc, + render_extract=check_query_helpers.render_extract, render_percentile_expr=check_query_helpers.render_percentile_expr, mf_time_spine_source=semantic_manifest_lookup.time_spine_source.spine_table.sql, double_data_type_name=check_query_helpers.double_data_type_name, 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/plan_conversion/test_dataflow_to_sql_plan.py b/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py index a387521655..782fa1caf3 100644 --- a/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py +++ b/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py @@ -56,6 +56,7 @@ from metricflow.test.snapshot_utils import assert_plan_snapshot_text_equal from metricflow.test.sql.compare_sql_plan import assert_rendered_sql_from_plan_equal, assert_sql_plan_text_equal from metricflow.test.time.metric_time_dimension import MTD_SPEC_DAY, MTD_SPEC_QUARTER, MTD_SPEC_WEEK, MTD_SPEC_YEAR +from metricflow.time.date_part import DatePart @pytest.fixture(scope="session") @@ -1843,3 +1844,84 @@ def test_derived_offset_cumulative_metric( # noqa: D sql_client=sql_client, node=dataflow_plan.sink_output_nodes[0].parent_node, ) + + +def test_simple_query_with_date_part( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) + + +def test_simple_query_with_multiple_date_parts( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.WEEK), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) + + +def test_offset_window_with_date_part( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings_growth_2_weeks"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) diff --git a/metricflow/test/query/test_query_parser.py b/metricflow/test/query/test_query_parser.py index d585ab4465..ba93699eed 100644 --- a/metricflow/test/query/test_query_parser.py +++ b/metricflow/test/query/test_query_parser.py @@ -21,9 +21,11 @@ OrderBySpec, TimeDimensionSpec, ) +from metricflow.test.conftest import MockQueryParameter from metricflow.test.fixtures.model_fixtures import query_parser_from_yaml from metricflow.test.model.example_project_configuration import EXAMPLE_PROJECT_CONFIGURATION_YAML_CONFIG_FILE from metricflow.test.time.metric_time_dimension import MTD +from metricflow.time.date_part import DatePart from metricflow.time.time_granularity_solver import RequestTimeGranularityException logger = logging.getLogger(__name__) @@ -134,6 +136,18 @@ - name: revenue offset_window: 14 days alias: revenue_2_weeks_ago + --- + metric: + name: revenue_since_start_of_year + description: Revenue since start of year + type: derived + type_params: + expr: revenue - revenue_start_of_year + metrics: + - name: revenue + - name: revenue + offset_to_grain: year + alias: revenue_start_of_year """ ) @@ -171,15 +185,6 @@ def test_query_parser(bookings_query_parser: MetricFlowQueryParser) -> None: # ) -class MockQueryParameter: - """This is a mock that is just used to test the query parser.""" - - grain = None - - def __init__(self, name: str): # noqa: D - self.name = name - - def test_query_parser_with_object_params(bookings_query_parser: MetricFlowQueryParser) -> None: # noqa: D Metric = namedtuple("Metric", ["name"]) metric = Metric("bookings") @@ -371,11 +376,10 @@ def test_derived_metric_query_parsing() -> None: def test_derived_metric_with_offset_parsing() -> None: """Test that querying derived metrics with a time offset requires a time dimension.""" - bookings_yaml_file = YamlConfigFile(filepath="inline_for_test_1", contents=BOOKINGS_YAML) - bookings_yaml_file = YamlConfigFile(filepath="inline_for_test_1", contents=REVENUE_YAML) + revenue_yaml_file = YamlConfigFile(filepath="inline_for_test_1", contents=REVENUE_YAML) metrics_yaml_file = YamlConfigFile(filepath="inline_for_test_1", contents=METRICS_YAML) query_parser = query_parser_from_yaml( - [EXAMPLE_PROJECT_CONFIGURATION_YAML_CONFIG_FILE, bookings_yaml_file, metrics_yaml_file] + [EXAMPLE_PROJECT_CONFIGURATION_YAML_CONFIG_FILE, revenue_yaml_file, metrics_yaml_file] ) # Attempt to query with no dimension with pytest.raises(UnableToSatisfyQueryError): @@ -396,3 +400,46 @@ def test_derived_metric_with_offset_parsing() -> None: metric_names=["revenue_growth_2_weeks"], group_by_names=[MTD], ) + + +def test_date_part_parsing() -> None: + """Test that querying with a date_part verifies compatibility with time_granularity.""" + revenue_yaml_file = YamlConfigFile(filepath="inline_for_test_1", contents=REVENUE_YAML) + metrics_yaml_file = YamlConfigFile(filepath="inline_for_test_1", contents=METRICS_YAML) + query_parser = query_parser_from_yaml( + [EXAMPLE_PROJECT_CONFIGURATION_YAML_CONFIG_FILE, revenue_yaml_file, metrics_yaml_file] + ) + + # Date part is incompatible with metric's defined time granularity + with pytest.raises(RequestTimeGranularityException): + query_parser.parse_and_validate_query( + metric_names=["revenue"], + group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.DOW)], + ) + + # Can't query date part for cumulative metrics + with pytest.raises(UnableToSatisfyQueryError): + query_parser.parse_and_validate_query( + metric_names=["revenue_cumulative"], + group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.YEAR)], + ) + + # Can't query date part for metrics with offset to grain + with pytest.raises(UnableToSatisfyQueryError): + query_parser.parse_and_validate_query( + metric_names=["revenue_since_start_of_year"], + group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.MONTH)], + ) + + # Requested granularity doesn't match resolved granularity + with pytest.raises(RequestTimeGranularityException): + query_parser.parse_and_validate_query( + metric_names=["revenue"], + group_by=[MockQueryParameter(name="metric_time", grain=TimeGranularity.YEAR, date_part=DatePart.MONTH)], + ) + + # Date part is compatible + query_parser.parse_and_validate_query( + metric_names=["revenue"], + group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.MONTH)], + ) 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..95c23db647 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..21f374f1fe 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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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..abec542070 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS user__ds__extract_doy , 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..dab2be52a2 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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..93f9b1f47a 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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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..e96f783576 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(dow FROM users_latest_src_10008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy , 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..dab2be52a2 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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..93f9b1f47a 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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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..e96f783576 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(dow FROM users_latest_src_10008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy , 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..dab2be52a2 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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..93f9b1f47a 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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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..e96f783576 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(dow FROM users_latest_src_10008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy , 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..dab2be52a2 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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..93f9b1f47a 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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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..e96f783576 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(dow FROM users_latest_src_10008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy , 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..dab2be52a2 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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..93f9b1f47a 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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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..e96f783576 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(dow FROM users_latest_src_10008.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy , 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..108556d708 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 @@ + + @@ -132,23 +138,37 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -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..eda032ff2f 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -239,32 +379,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..ed7c79b643 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..178465c7ed 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,36 +51,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -125,32 +174,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +266,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -218,11 +344,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +371,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,26 +450,61 @@ 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_dow + , subq_10.ds__extract_doy , 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_dow + , subq_10.ds_partitioned__extract_doy , 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_dow + , subq_10.view__ds__extract_doy , 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_dow + , subq_10.view__ds_partitioned__extract_doy , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month , subq_10.ds__quarter AS metric_time__quarter , subq_10.ds__year AS metric_time__year + , subq_10.ds__extract_year AS metric_time__extract_year + , subq_10.ds__extract_quarter AS metric_time__extract_quarter + , subq_10.ds__extract_month AS metric_time__extract_month + , subq_10.ds__extract_week AS metric_time__extract_week + , subq_10.ds__extract_day AS metric_time__extract_day + , subq_10.ds__extract_dow AS metric_time__extract_dow + , subq_10.ds__extract_doy AS metric_time__extract_doy , subq_10.listing , subq_10.user , subq_10.view__listing @@ -330,21 +519,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(isoweek 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_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds) AS view__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy , 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,26 +584,61 @@ 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_dow + , subq_13.ds__extract_doy , 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_dow + , subq_13.created_at__extract_doy , 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_dow + , subq_13.listing__ds__extract_doy , 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_dow + , subq_13.listing__created_at__extract_doy , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month , subq_13.ds__quarter AS metric_time__quarter , subq_13.ds__year AS metric_time__year + , subq_13.ds__extract_year AS metric_time__extract_year + , subq_13.ds__extract_quarter AS metric_time__extract_quarter + , subq_13.ds__extract_month AS metric_time__extract_month + , subq_13.ds__extract_week AS metric_time__extract_week + , subq_13.ds__extract_day AS metric_time__extract_day + , subq_13.ds__extract_dow AS metric_time__extract_dow + , subq_13.ds__extract_doy AS metric_time__extract_doy , subq_13.listing , subq_13.user , subq_13.listing__user @@ -410,11 +662,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +689,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..8969f7a6c0 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..1ddd22d435 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..7e50393d6d 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..bd9b392402 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..639e816eb6 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..cd58d0ce0d 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,16 +18,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -40,11 +61,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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..35cc71b613 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..829e30ded9 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..c8630b8f49 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..ffc899b824 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +261,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -244,32 +384,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2705007543 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..7d7c920907 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..62768ac034 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..229acaf841 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..a4c8b503e4 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +368,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,36 +470,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -369,32 +593,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..9107fdbe8a 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +369,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,36 +471,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -370,32 +594,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..0d9742944b 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_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , 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_dow AS ds_partitioned__extract_dow + , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_4.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,35 +130,84 @@ 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.metric_time__week AS metric_time__week , subq_1.metric_time__month AS metric_time__month , subq_1.metric_time__quarter AS metric_time__quarter , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_week AS metric_time__extract_week + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -152,36 +243,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -226,32 +366,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..13415b0ae2 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,36 +129,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -161,32 +252,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..5c0e215038 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,36 +42,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -116,32 +165,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +257,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -209,11 +335,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +362,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..12f6f6e38a 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d13bb8fafe 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..a4205ece06 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,36 +48,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -122,32 +171,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +263,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -215,11 +341,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +368,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..1d933aaf04 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 @@ -50,36 +50,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -110,32 +159,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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -164,11 +255,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +282,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity 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..fd5aaaa276 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..438ffdddad 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..919c372968 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..9bedbf14e2 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,36 +26,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..5ee683c896 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,26 +21,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.created_at__extract_doy , 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_dow + , subq_0.listing__ds__extract_doy , 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_dow + , subq_0.listing__created_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.user , subq_0.listing__user @@ -64,11 +99,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +126,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..ff2afccd69 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..77cede8ad4 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,36 +60,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -134,32 +183,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +275,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -227,11 +353,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +380,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +471,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -391,32 +594,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +686,61 @@ 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_dow + , subq_15.ds__extract_doy , 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_dow + , subq_15.created_at__extract_doy , 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_dow + , subq_15.listing__ds__extract_doy , 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_dow + , subq_15.listing__created_at__extract_doy , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month , subq_15.ds__quarter AS metric_time__quarter , subq_15.ds__year AS metric_time__year + , subq_15.ds__extract_year AS metric_time__extract_year + , subq_15.ds__extract_quarter AS metric_time__extract_quarter + , subq_15.ds__extract_month AS metric_time__extract_month + , subq_15.ds__extract_week AS metric_time__extract_week + , subq_15.ds__extract_day AS metric_time__extract_day + , subq_15.ds__extract_dow AS metric_time__extract_dow + , subq_15.ds__extract_doy AS metric_time__extract_doy , subq_15.listing , subq_15.user , subq_15.listing__user @@ -484,11 +764,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +791,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +865,85 @@ 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_dow + , subq_24.ds__extract_doy , 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_dow + , subq_24.ds_partitioned__extract_doy , 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_dow + , subq_24.paid_at__extract_doy , 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_dow + , subq_24.booking__ds__extract_doy , 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_dow + , subq_24.booking__ds_partitioned__extract_doy , 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_dow + , subq_24.booking__paid_at__extract_doy , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month , subq_24.ds__quarter AS metric_time__quarter , subq_24.ds__year AS metric_time__year + , subq_24.ds__extract_year AS metric_time__extract_year + , subq_24.ds__extract_quarter AS metric_time__extract_quarter + , subq_24.ds__extract_month AS metric_time__extract_month + , subq_24.ds__extract_week AS metric_time__extract_week + , subq_24.ds__extract_day AS metric_time__extract_day + , subq_24.ds__extract_dow AS metric_time__extract_dow + , subq_24.ds__extract_doy AS metric_time__extract_doy , subq_24.listing , subq_24.guest , subq_24.host @@ -631,32 +988,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2431233751 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,36 +45,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -119,32 +168,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +277,85 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.ds_partitioned__extract_doy , 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_dow + , subq_7.paid_at__extract_doy , 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_dow + , subq_7.booking__ds__extract_doy , 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_dow + , subq_7.booking__ds_partitioned__extract_doy , 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_dow + , subq_7.booking__paid_at__extract_doy , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month , subq_7.ds__quarter AS metric_time__quarter , subq_7.ds__year AS metric_time__year + , subq_7.ds__extract_year AS metric_time__extract_year + , subq_7.ds__extract_quarter AS metric_time__extract_quarter + , subq_7.ds__extract_month AS metric_time__extract_month + , subq_7.ds__extract_week AS metric_time__extract_week + , subq_7.ds__extract_day AS metric_time__extract_day + , subq_7.ds__extract_dow AS metric_time__extract_dow + , subq_7.ds__extract_doy AS metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -260,32 +400,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c9052ccd01 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,36 +39,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -113,32 +162,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..78bc20baf3 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +251,61 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.created_at__extract_doy , 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_dow + , subq_5.listing__ds__extract_doy , 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_dow + , subq_5.listing__created_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.user , subq_5.listing__user @@ -203,11 +329,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +356,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..fa17fe59fa 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -154,26 +245,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_dow AS window_start__extract_dow + , subq_3.window_start__extract_doy AS window_start__extract_doy , 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_dow AS window_end__extract_dow + , subq_3.window_end__extract_doy AS window_end__extract_doy , 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_dow AS listing__window_start__extract_dow + , subq_3.listing__window_start__extract_doy AS listing__window_start__extract_doy , 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_dow AS listing__window_end__extract_dow + , subq_3.listing__window_end__extract_doy AS listing__window_end__extract_doy , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dow AS user__ds__extract_dow + , subq_5.ds__extract_doy AS user__ds__extract_doy , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +318,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +345,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , 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 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +407,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_dow + , subq_4.ds__extract_doy , 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_dow + , subq_4.user__ds__extract_doy , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +437,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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_latest_src_10021.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_latest_src_10021.ds) AS user__ds__extract_doy , 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 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..eb008dd112 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -157,11 +248,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_dow AS lux_listing__window_start__extract_dow + , subq_5.window_start__extract_doy AS lux_listing__window_start__extract_doy , 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_dow AS lux_listing__window_end__extract_dow + , subq_5.window_end__extract_doy AS lux_listing__window_end__extract_doy , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +338,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_dow + , subq_4.window_start__extract_doy , 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_dow + , subq_4.window_end__extract_doy , 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_dow + , subq_4.lux_listing__window_start__extract_doy , 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_dow + , subq_4.lux_listing__window_end__extract_doy , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +392,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(isoweek 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_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy , 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 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..7896f7776d 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..59e26e6b2d 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,26 +36,61 @@ 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.account_id__ds_partitioned__extract_doy , 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_dow + , subq_0.account_id__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.account_id , subq_0.account_month , subq_0.account_id__account_month @@ -69,22 +104,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(isoweek 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_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy , 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 +169,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_dow AS ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS account_id__ds_partitioned__extract_dow + , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy , 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_dow AS customer_id__ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy , 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 +216,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(isoweek 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_dow + , EXTRACT(dayofyear FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- '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__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +278,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_dow + , subq_4.ds_partitioned__extract_doy , 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_dow + , subq_4.customer_id__ds_partitioned__extract_doy , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +312,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(isoweek 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_dow + , EXTRACT(dayofyear FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy , 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 +326,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(isoweek 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_dow + , EXTRACT(dayofyear FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy , 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..a6f0b3d5fc 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,36 +23,85 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.ds_partitioned__extract_doy , 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_dow + , subq_1.paid_at__extract_doy , 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_dow + , subq_1.booking__ds__extract_doy , 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_dow + , subq_1.booking__ds_partitioned__extract_doy , 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_dow + , subq_1.booking__paid_at__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.listing , subq_1.guest , subq_1.host @@ -82,36 +131,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -156,32 +254,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +357,61 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.created_at__extract_doy , 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_dow + , subq_7.listing__ds__extract_doy , 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_dow + , subq_7.listing__created_at__extract_doy , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month , subq_7.metric_time__quarter , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_week + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.user , subq_7.listing__user @@ -257,26 +432,61 @@ 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_dow + , subq_6.ds__extract_doy , 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_dow + , subq_6.created_at__extract_doy , 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_dow + , subq_6.listing__ds__extract_doy , 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_dow + , subq_6.listing__created_at__extract_doy , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month , subq_6.ds__quarter AS metric_time__quarter , subq_6.ds__year AS metric_time__year + , subq_6.ds__extract_year AS metric_time__extract_year + , subq_6.ds__extract_quarter AS metric_time__extract_quarter + , subq_6.ds__extract_month AS metric_time__extract_month + , subq_6.ds__extract_week AS metric_time__extract_week + , subq_6.ds__extract_day AS metric_time__extract_day + , subq_6.ds__extract_dow AS metric_time__extract_dow + , subq_6.ds__extract_doy AS metric_time__extract_doy , subq_6.listing , subq_6.user , subq_6.listing__user @@ -300,11 +510,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +537,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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..189d129aa7 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,36 +44,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -118,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +273,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -256,32 +396,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +514,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -406,32 +637,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +753,85 @@ 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_dow + , subq_17.ds__extract_doy , 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_dow + , subq_17.ds_partitioned__extract_doy , 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_dow + , subq_17.paid_at__extract_doy , 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_dow + , subq_17.booking__ds__extract_doy , 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_dow + , subq_17.booking__ds_partitioned__extract_doy , 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_dow + , subq_17.booking__paid_at__extract_doy , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month , subq_17.ds__quarter AS metric_time__quarter , subq_17.ds__year AS metric_time__year + , subq_17.ds__extract_year AS metric_time__extract_year + , subq_17.ds__extract_quarter AS metric_time__extract_quarter + , subq_17.ds__extract_month AS metric_time__extract_month + , subq_17.ds__extract_week AS metric_time__extract_week + , subq_17.ds__extract_day AS metric_time__extract_day + , subq_17.ds__extract_dow AS metric_time__extract_dow + , subq_17.ds__extract_doy AS metric_time__extract_doy , subq_17.listing , subq_17.guest , subq_17.host @@ -554,32 +876,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..f5af97ec20 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dayofweek FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , 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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , 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_dow + , subq_5.ds_partitioned__extract_doy + , 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_dow + , subq_5.paid_at__extract_doy + , 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_dow + , subq_5.booking__ds__extract_doy + , 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_dow + , subq_5.booking__ds_partitioned__extract_doy + , 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_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATE_SUB(CAST(subq_7.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..3281174961 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dayofweek FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.metric_time__day + GROUP BY + metric_time__extract_dow + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 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..34b763eb68 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..edb417b214 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,26 +36,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.verification__ds__extract_doy , 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_dow + , subq_0.verification__ds_partitioned__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.verification , subq_0.user , subq_0.verification__user @@ -71,22 +106,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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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 +173,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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy , 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..07e622e748 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..060f3efacd 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(isoweek FROM ds) AS ds__extract_week + , EXTRACT(day FROM ds) AS ds__extract_day + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , 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(isoweek FROM ds) AS account__ds__extract_week + , EXTRACT(day FROM ds) AS account__ds__extract_day + , EXTRACT(dayofweek FROM ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy , 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..f13236380c 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..8a36408f84 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(isoweek FROM ds) AS ds__extract_week + , EXTRACT(day FROM ds) AS ds__extract_day + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , 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(isoweek FROM ds) AS account__ds__extract_week + , EXTRACT(day FROM ds) AS account__ds__extract_day + , EXTRACT(dayofweek FROM ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy , 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..eff1adbdb9 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..025caeebfc 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(isoweek FROM ds) AS ds__extract_week + , EXTRACT(day FROM ds) AS ds__extract_day + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , 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(isoweek FROM ds) AS account__ds__extract_week + , EXTRACT(day FROM ds) AS account__ds__extract_day + , EXTRACT(dayofweek FROM ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy , 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_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..031517a99c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..9ccede846b --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..ec4e2ef1e8 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..1d96b88869 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(isoweek FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , EXTRACT(dayofyear FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy 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..e01a0418ff 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..0ba3c40334 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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..3e49f05f72 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(isoweek FROM ds) AS ds__extract_week + , EXTRACT(day FROM ds) AS ds__extract_day + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy , 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(isoweek FROM ds) AS booking__ds__extract_week + , EXTRACT(day FROM ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy , 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..b954d8927e 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -239,32 +379,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b1bf877e84 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5373f3b9a9 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,36 +51,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -125,32 +174,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +266,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -218,11 +344,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +371,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,26 +450,61 @@ 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_dow + , subq_10.ds__extract_doy , 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_dow + , subq_10.ds_partitioned__extract_doy , 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_dow + , subq_10.view__ds__extract_doy , 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_dow + , subq_10.view__ds_partitioned__extract_doy , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month , subq_10.ds__quarter AS metric_time__quarter , subq_10.ds__year AS metric_time__year + , subq_10.ds__extract_year AS metric_time__extract_year + , subq_10.ds__extract_quarter AS metric_time__extract_quarter + , subq_10.ds__extract_month AS metric_time__extract_month + , subq_10.ds__extract_week AS metric_time__extract_week + , subq_10.ds__extract_day AS metric_time__extract_day + , subq_10.ds__extract_dow AS metric_time__extract_dow + , subq_10.ds__extract_doy AS metric_time__extract_doy , subq_10.listing , subq_10.user , subq_10.view__listing @@ -330,21 +519,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(dow FROM views_source_src_10009.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM views_source_src_10009.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS view__ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy , 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,26 +584,61 @@ 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_dow + , subq_13.ds__extract_doy , 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_dow + , subq_13.created_at__extract_doy , 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_dow + , subq_13.listing__ds__extract_doy , 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_dow + , subq_13.listing__created_at__extract_doy , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month , subq_13.ds__quarter AS metric_time__quarter , subq_13.ds__year AS metric_time__year + , subq_13.ds__extract_year AS metric_time__extract_year + , subq_13.ds__extract_quarter AS metric_time__extract_quarter + , subq_13.ds__extract_month AS metric_time__extract_month + , subq_13.ds__extract_week AS metric_time__extract_week + , subq_13.ds__extract_day AS metric_time__extract_day + , subq_13.ds__extract_dow AS metric_time__extract_dow + , subq_13.ds__extract_doy AS metric_time__extract_doy , subq_13.listing , subq_13.user , subq_13.listing__user @@ -410,11 +662,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +689,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..1bd176c115 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..cd879426f7 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5b6dd99cc4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..6920a36691 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..4080ab9420 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..fcf74a5947 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,16 +18,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -40,11 +61,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..0143335613 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5cba3a3202 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..414159089b 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5b4011175d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +261,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -244,32 +384,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d11a69936d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b98d6d0f3d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..9139bc862d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..0022a4f526 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..10bb6c0450 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +368,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,36 +470,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -369,32 +593,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..1aaa96b40a 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +369,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,36 +471,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -370,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..3107752f3d 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_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , 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_dow AS ds_partitioned__extract_dow + , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_4.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,35 +130,84 @@ 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.metric_time__week AS metric_time__week , subq_1.metric_time__month AS metric_time__month , subq_1.metric_time__quarter AS metric_time__quarter , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_week AS metric_time__extract_week + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -152,36 +243,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -226,32 +366,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..666e2d3376 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,36 +129,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -161,32 +252,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..40f6785af3 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,36 +42,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -116,32 +165,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +257,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -209,11 +335,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +362,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a43457fcbd 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..a3ce23fb89 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..70919d8caa 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,36 +48,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -122,32 +171,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +263,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -215,11 +341,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +368,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..6e4488a729 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 @@ -50,36 +50,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -110,32 +159,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -164,11 +255,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +282,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity 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..9f23719b49 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..1c6b0467ff 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2093e49b0b 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..eb506ddf59 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,36 +26,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d5688f0e2d 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,26 +21,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.created_at__extract_doy , 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_dow + , subq_0.listing__ds__extract_doy , 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_dow + , subq_0.listing__created_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.user , subq_0.listing__user @@ -64,11 +99,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +126,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..dbfcb34b94 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e5349b0d17 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,36 +60,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -134,32 +183,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +275,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -227,11 +353,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +380,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +471,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -391,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +686,61 @@ 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_dow + , subq_15.ds__extract_doy , 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_dow + , subq_15.created_at__extract_doy , 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_dow + , subq_15.listing__ds__extract_doy , 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_dow + , subq_15.listing__created_at__extract_doy , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month , subq_15.ds__quarter AS metric_time__quarter , subq_15.ds__year AS metric_time__year + , subq_15.ds__extract_year AS metric_time__extract_year + , subq_15.ds__extract_quarter AS metric_time__extract_quarter + , subq_15.ds__extract_month AS metric_time__extract_month + , subq_15.ds__extract_week AS metric_time__extract_week + , subq_15.ds__extract_day AS metric_time__extract_day + , subq_15.ds__extract_dow AS metric_time__extract_dow + , subq_15.ds__extract_doy AS metric_time__extract_doy , subq_15.listing , subq_15.user , subq_15.listing__user @@ -484,11 +764,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +791,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +865,85 @@ 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_dow + , subq_24.ds__extract_doy , 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_dow + , subq_24.ds_partitioned__extract_doy , 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_dow + , subq_24.paid_at__extract_doy , 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_dow + , subq_24.booking__ds__extract_doy , 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_dow + , subq_24.booking__ds_partitioned__extract_doy , 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_dow + , subq_24.booking__paid_at__extract_doy , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month , subq_24.ds__quarter AS metric_time__quarter , subq_24.ds__year AS metric_time__year + , subq_24.ds__extract_year AS metric_time__extract_year + , subq_24.ds__extract_quarter AS metric_time__extract_quarter + , subq_24.ds__extract_month AS metric_time__extract_month + , subq_24.ds__extract_week AS metric_time__extract_week + , subq_24.ds__extract_day AS metric_time__extract_day + , subq_24.ds__extract_dow AS metric_time__extract_dow + , subq_24.ds__extract_doy AS metric_time__extract_doy , subq_24.listing , subq_24.guest , subq_24.host @@ -631,32 +988,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c11754db0d 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,36 +45,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -119,32 +168,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +277,85 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.ds_partitioned__extract_doy , 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_dow + , subq_7.paid_at__extract_doy , 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_dow + , subq_7.booking__ds__extract_doy , 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_dow + , subq_7.booking__ds_partitioned__extract_doy , 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_dow + , subq_7.booking__paid_at__extract_doy , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month , subq_7.ds__quarter AS metric_time__quarter , subq_7.ds__year AS metric_time__year + , subq_7.ds__extract_year AS metric_time__extract_year + , subq_7.ds__extract_quarter AS metric_time__extract_quarter + , subq_7.ds__extract_month AS metric_time__extract_month + , subq_7.ds__extract_week AS metric_time__extract_week + , subq_7.ds__extract_day AS metric_time__extract_day + , subq_7.ds__extract_dow AS metric_time__extract_dow + , subq_7.ds__extract_doy AS metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -260,32 +400,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..bd41d48bd9 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,36 +39,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -113,32 +162,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..ecc15101fe 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +251,61 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.created_at__extract_doy , 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_dow + , subq_5.listing__ds__extract_doy , 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_dow + , subq_5.listing__created_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.user , subq_5.listing__user @@ -203,11 +329,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +356,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..79946c1bc1 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -154,26 +245,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_dow AS window_start__extract_dow + , subq_3.window_start__extract_doy AS window_start__extract_doy , 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_dow AS window_end__extract_dow + , subq_3.window_end__extract_doy AS window_end__extract_doy , 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_dow AS listing__window_start__extract_dow + , subq_3.listing__window_start__extract_doy AS listing__window_start__extract_doy , 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_dow AS listing__window_end__extract_dow + , subq_3.listing__window_end__extract_doy AS listing__window_end__extract_doy , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dow AS user__ds__extract_dow + , subq_5.ds__extract_doy AS user__ds__extract_doy , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +318,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +345,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , 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 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +407,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_dow + , subq_4.ds__extract_doy , 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_dow + , subq_4.user__ds__extract_doy , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +437,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(dow FROM users_latest_src_10021.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10021.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS user__ds__extract_doy , 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 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..1cfb7780a7 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -157,11 +248,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_dow AS lux_listing__window_start__extract_dow + , subq_5.window_start__extract_doy AS lux_listing__window_start__extract_doy , 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_dow AS lux_listing__window_end__extract_dow + , subq_5.window_end__extract_doy AS lux_listing__window_end__extract_doy , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +338,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_dow + , subq_4.window_start__extract_doy , 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_dow + , subq_4.window_end__extract_doy , 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_dow + , subq_4.lux_listing__window_start__extract_doy , 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_dow + , subq_4.lux_listing__window_end__extract_doy , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +392,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(dow FROM lux_listings_src_10019.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy , 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(dow FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy , 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 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..7e38380b20 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..0d1825bde4 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,26 +36,61 @@ 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.account_id__ds_partitioned__extract_doy , 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_dow + , subq_0.account_id__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.account_id , subq_0.account_month , subq_0.account_id__account_month @@ -69,22 +104,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(dow FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS ds__extract_doy , 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(dow FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy , 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 +169,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_dow AS ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS account_id__ds_partitioned__extract_dow + , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy , 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_dow AS customer_id__ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy , 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 +216,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(dow FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- '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__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +278,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_dow + , subq_4.ds_partitioned__extract_doy , 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_dow + , subq_4.customer_id__ds_partitioned__extract_doy , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +312,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(dow FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy , 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 +326,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(dow FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy , 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..54b108dd33 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,36 +23,85 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.ds_partitioned__extract_doy , 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_dow + , subq_1.paid_at__extract_doy , 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_dow + , subq_1.booking__ds__extract_doy , 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_dow + , subq_1.booking__ds_partitioned__extract_doy , 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_dow + , subq_1.booking__paid_at__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.listing , subq_1.guest , subq_1.host @@ -82,36 +131,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -156,32 +254,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +357,61 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.created_at__extract_doy , 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_dow + , subq_7.listing__ds__extract_doy , 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_dow + , subq_7.listing__created_at__extract_doy , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month , subq_7.metric_time__quarter , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_week + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.user , subq_7.listing__user @@ -257,26 +432,61 @@ 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_dow + , subq_6.ds__extract_doy , 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_dow + , subq_6.created_at__extract_doy , 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_dow + , subq_6.listing__ds__extract_doy , 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_dow + , subq_6.listing__created_at__extract_doy , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month , subq_6.ds__quarter AS metric_time__quarter , subq_6.ds__year AS metric_time__year + , subq_6.ds__extract_year AS metric_time__extract_year + , subq_6.ds__extract_quarter AS metric_time__extract_quarter + , subq_6.ds__extract_month AS metric_time__extract_month + , subq_6.ds__extract_week AS metric_time__extract_week + , subq_6.ds__extract_day AS metric_time__extract_day + , subq_6.ds__extract_dow AS metric_time__extract_dow + , subq_6.ds__extract_doy AS metric_time__extract_doy , subq_6.listing , subq_6.user , subq_6.listing__user @@ -300,11 +510,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +537,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a716977aaf 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,36 +44,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -118,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +273,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -256,32 +396,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +514,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -406,32 +637,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +753,85 @@ 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_dow + , subq_17.ds__extract_doy , 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_dow + , subq_17.ds_partitioned__extract_doy , 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_dow + , subq_17.paid_at__extract_doy , 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_dow + , subq_17.booking__ds__extract_doy , 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_dow + , subq_17.booking__ds_partitioned__extract_doy , 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_dow + , subq_17.booking__paid_at__extract_doy , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month , subq_17.ds__quarter AS metric_time__quarter , subq_17.ds__year AS metric_time__year + , subq_17.ds__extract_year AS metric_time__extract_year + , subq_17.ds__extract_quarter AS metric_time__extract_quarter + , subq_17.ds__extract_month AS metric_time__extract_month + , subq_17.ds__extract_week AS metric_time__extract_week + , subq_17.ds__extract_day AS metric_time__extract_day + , subq_17.ds__extract_dow AS metric_time__extract_dow + , subq_17.ds__extract_doy AS metric_time__extract_doy , subq_17.listing , subq_17.guest , subq_17.host @@ -554,32 +876,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..68e1d3302c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , 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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , 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_dow + , subq_5.ds_partitioned__extract_doy + , 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_dow + , subq_5.paid_at__extract_doy + , 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_dow + , subq_5.booking__ds__extract_doy + , 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_dow + , subq_5.booking__ds_partitioned__extract_doy + , 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_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..d1a408e031 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 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..d6632b499f 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..44cff4ab94 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,26 +36,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.verification__ds__extract_doy , 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_dow + , subq_0.verification__ds_partitioned__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.verification , subq_0.user , subq_0.verification__user @@ -71,22 +106,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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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 +173,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(dow FROM users_ds_source_src_10007.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM users_ds_source_src_10007.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy , 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..33fc914795 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d90abbd294 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..dc98b44d95 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d723157d2a 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..95274f2863 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..e0c877bdf1 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy 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..9c6e0a2676 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..b9ae7f84a4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d1560d9ab0 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , 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..b954d8927e 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -239,32 +379,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b1bf877e84 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5373f3b9a9 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,36 +51,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -125,32 +174,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +266,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -218,11 +344,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +371,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,26 +450,61 @@ 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_dow + , subq_10.ds__extract_doy , 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_dow + , subq_10.ds_partitioned__extract_doy , 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_dow + , subq_10.view__ds__extract_doy , 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_dow + , subq_10.view__ds_partitioned__extract_doy , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month , subq_10.ds__quarter AS metric_time__quarter , subq_10.ds__year AS metric_time__year + , subq_10.ds__extract_year AS metric_time__extract_year + , subq_10.ds__extract_quarter AS metric_time__extract_quarter + , subq_10.ds__extract_month AS metric_time__extract_month + , subq_10.ds__extract_week AS metric_time__extract_week + , subq_10.ds__extract_day AS metric_time__extract_day + , subq_10.ds__extract_dow AS metric_time__extract_dow + , subq_10.ds__extract_doy AS metric_time__extract_doy , subq_10.listing , subq_10.user , subq_10.view__listing @@ -330,21 +519,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(dow FROM views_source_src_10009.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM views_source_src_10009.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS view__ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy , 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,26 +584,61 @@ 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_dow + , subq_13.ds__extract_doy , 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_dow + , subq_13.created_at__extract_doy , 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_dow + , subq_13.listing__ds__extract_doy , 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_dow + , subq_13.listing__created_at__extract_doy , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month , subq_13.ds__quarter AS metric_time__quarter , subq_13.ds__year AS metric_time__year + , subq_13.ds__extract_year AS metric_time__extract_year + , subq_13.ds__extract_quarter AS metric_time__extract_quarter + , subq_13.ds__extract_month AS metric_time__extract_month + , subq_13.ds__extract_week AS metric_time__extract_week + , subq_13.ds__extract_day AS metric_time__extract_day + , subq_13.ds__extract_dow AS metric_time__extract_dow + , subq_13.ds__extract_doy AS metric_time__extract_doy , subq_13.listing , subq_13.user , subq_13.listing__user @@ -410,11 +662,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +689,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..1bd176c115 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..cd879426f7 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5b6dd99cc4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..6920a36691 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..4080ab9420 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..fcf74a5947 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,16 +18,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -40,11 +61,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..0143335613 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5cba3a3202 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..414159089b 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5b4011175d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +261,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -244,32 +384,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d11a69936d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b98d6d0f3d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..38aeec72e9 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..0ad6211336 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c987150223 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +368,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,36 +470,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -369,32 +593,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..cddee48ddb 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +369,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,36 +471,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -370,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..94cf44278b 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_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , 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_dow AS ds_partitioned__extract_dow + , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_4.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,35 +130,84 @@ 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.metric_time__week AS metric_time__week , subq_1.metric_time__month AS metric_time__month , subq_1.metric_time__quarter AS metric_time__quarter , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_week AS metric_time__extract_week + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -152,36 +243,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -226,32 +366,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..6b4f9e31f9 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,36 +129,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -161,32 +252,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..40f6785af3 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,36 +42,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -116,32 +165,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +257,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -209,11 +335,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +362,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a43457fcbd 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..a3ce23fb89 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..70919d8caa 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,36 +48,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -122,32 +171,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +263,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -215,11 +341,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +368,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..6e4488a729 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 @@ -50,36 +50,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -110,32 +159,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -164,11 +255,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +282,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity 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..9f23719b49 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..406b83cae3 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2093e49b0b 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..eb506ddf59 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,36 +26,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d5688f0e2d 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,26 +21,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.created_at__extract_doy , 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_dow + , subq_0.listing__ds__extract_doy , 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_dow + , subq_0.listing__created_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.user , subq_0.listing__user @@ -64,11 +99,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +126,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..dbfcb34b94 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e5349b0d17 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,36 +60,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -134,32 +183,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +275,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -227,11 +353,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +380,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +471,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -391,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +686,61 @@ 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_dow + , subq_15.ds__extract_doy , 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_dow + , subq_15.created_at__extract_doy , 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_dow + , subq_15.listing__ds__extract_doy , 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_dow + , subq_15.listing__created_at__extract_doy , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month , subq_15.ds__quarter AS metric_time__quarter , subq_15.ds__year AS metric_time__year + , subq_15.ds__extract_year AS metric_time__extract_year + , subq_15.ds__extract_quarter AS metric_time__extract_quarter + , subq_15.ds__extract_month AS metric_time__extract_month + , subq_15.ds__extract_week AS metric_time__extract_week + , subq_15.ds__extract_day AS metric_time__extract_day + , subq_15.ds__extract_dow AS metric_time__extract_dow + , subq_15.ds__extract_doy AS metric_time__extract_doy , subq_15.listing , subq_15.user , subq_15.listing__user @@ -484,11 +764,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +791,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +865,85 @@ 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_dow + , subq_24.ds__extract_doy , 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_dow + , subq_24.ds_partitioned__extract_doy , 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_dow + , subq_24.paid_at__extract_doy , 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_dow + , subq_24.booking__ds__extract_doy , 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_dow + , subq_24.booking__ds_partitioned__extract_doy , 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_dow + , subq_24.booking__paid_at__extract_doy , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month , subq_24.ds__quarter AS metric_time__quarter , subq_24.ds__year AS metric_time__year + , subq_24.ds__extract_year AS metric_time__extract_year + , subq_24.ds__extract_quarter AS metric_time__extract_quarter + , subq_24.ds__extract_month AS metric_time__extract_month + , subq_24.ds__extract_week AS metric_time__extract_week + , subq_24.ds__extract_day AS metric_time__extract_day + , subq_24.ds__extract_dow AS metric_time__extract_dow + , subq_24.ds__extract_doy AS metric_time__extract_doy , subq_24.listing , subq_24.guest , subq_24.host @@ -631,32 +988,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c11754db0d 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,36 +45,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -119,32 +168,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +277,85 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.ds_partitioned__extract_doy , 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_dow + , subq_7.paid_at__extract_doy , 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_dow + , subq_7.booking__ds__extract_doy , 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_dow + , subq_7.booking__ds_partitioned__extract_doy , 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_dow + , subq_7.booking__paid_at__extract_doy , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month , subq_7.ds__quarter AS metric_time__quarter , subq_7.ds__year AS metric_time__year + , subq_7.ds__extract_year AS metric_time__extract_year + , subq_7.ds__extract_quarter AS metric_time__extract_quarter + , subq_7.ds__extract_month AS metric_time__extract_month + , subq_7.ds__extract_week AS metric_time__extract_week + , subq_7.ds__extract_day AS metric_time__extract_day + , subq_7.ds__extract_dow AS metric_time__extract_dow + , subq_7.ds__extract_doy AS metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -260,32 +400,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..bd41d48bd9 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,36 +39,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -113,32 +162,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..ecc15101fe 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +251,61 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.created_at__extract_doy , 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_dow + , subq_5.listing__ds__extract_doy , 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_dow + , subq_5.listing__created_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.user , subq_5.listing__user @@ -203,11 +329,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +356,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..79946c1bc1 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -154,26 +245,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_dow AS window_start__extract_dow + , subq_3.window_start__extract_doy AS window_start__extract_doy , 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_dow AS window_end__extract_dow + , subq_3.window_end__extract_doy AS window_end__extract_doy , 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_dow AS listing__window_start__extract_dow + , subq_3.listing__window_start__extract_doy AS listing__window_start__extract_doy , 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_dow AS listing__window_end__extract_dow + , subq_3.listing__window_end__extract_doy AS listing__window_end__extract_doy , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dow AS user__ds__extract_dow + , subq_5.ds__extract_doy AS user__ds__extract_doy , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +318,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +345,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , 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 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +407,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_dow + , subq_4.ds__extract_doy , 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_dow + , subq_4.user__ds__extract_doy , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +437,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(dow FROM users_latest_src_10021.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10021.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS user__ds__extract_doy , 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 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..1cfb7780a7 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -157,11 +248,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_dow AS lux_listing__window_start__extract_dow + , subq_5.window_start__extract_doy AS lux_listing__window_start__extract_doy , 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_dow AS lux_listing__window_end__extract_dow + , subq_5.window_end__extract_doy AS lux_listing__window_end__extract_doy , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +338,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_dow + , subq_4.window_start__extract_doy , 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_dow + , subq_4.window_end__extract_doy , 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_dow + , subq_4.lux_listing__window_start__extract_doy , 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_dow + , subq_4.lux_listing__window_end__extract_doy , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +392,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(dow FROM lux_listings_src_10019.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy , 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(dow FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy , 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 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..7e38380b20 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..0d1825bde4 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,26 +36,61 @@ 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.account_id__ds_partitioned__extract_doy , 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_dow + , subq_0.account_id__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.account_id , subq_0.account_month , subq_0.account_id__account_month @@ -69,22 +104,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(dow FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS ds__extract_doy , 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(dow FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy , 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 +169,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_dow AS ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS account_id__ds_partitioned__extract_dow + , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy , 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_dow AS customer_id__ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy , 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 +216,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(dow FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- '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__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +278,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_dow + , subq_4.ds_partitioned__extract_doy , 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_dow + , subq_4.customer_id__ds_partitioned__extract_doy , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +312,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(dow FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy , 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 +326,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(dow FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy , 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..54b108dd33 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,36 +23,85 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.ds_partitioned__extract_doy , 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_dow + , subq_1.paid_at__extract_doy , 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_dow + , subq_1.booking__ds__extract_doy , 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_dow + , subq_1.booking__ds_partitioned__extract_doy , 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_dow + , subq_1.booking__paid_at__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.listing , subq_1.guest , subq_1.host @@ -82,36 +131,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -156,32 +254,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +357,61 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.created_at__extract_doy , 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_dow + , subq_7.listing__ds__extract_doy , 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_dow + , subq_7.listing__created_at__extract_doy , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month , subq_7.metric_time__quarter , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_week + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.user , subq_7.listing__user @@ -257,26 +432,61 @@ 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_dow + , subq_6.ds__extract_doy , 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_dow + , subq_6.created_at__extract_doy , 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_dow + , subq_6.listing__ds__extract_doy , 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_dow + , subq_6.listing__created_at__extract_doy , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month , subq_6.ds__quarter AS metric_time__quarter , subq_6.ds__year AS metric_time__year + , subq_6.ds__extract_year AS metric_time__extract_year + , subq_6.ds__extract_quarter AS metric_time__extract_quarter + , subq_6.ds__extract_month AS metric_time__extract_month + , subq_6.ds__extract_week AS metric_time__extract_week + , subq_6.ds__extract_day AS metric_time__extract_day + , subq_6.ds__extract_dow AS metric_time__extract_dow + , subq_6.ds__extract_doy AS metric_time__extract_doy , subq_6.listing , subq_6.user , subq_6.listing__user @@ -300,11 +510,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +537,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a716977aaf 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,36 +44,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -118,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +273,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -256,32 +396,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +514,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -406,32 +637,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +753,85 @@ 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_dow + , subq_17.ds__extract_doy , 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_dow + , subq_17.ds_partitioned__extract_doy , 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_dow + , subq_17.paid_at__extract_doy , 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_dow + , subq_17.booking__ds__extract_doy , 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_dow + , subq_17.booking__ds_partitioned__extract_doy , 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_dow + , subq_17.booking__paid_at__extract_doy , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month , subq_17.ds__quarter AS metric_time__quarter , subq_17.ds__year AS metric_time__year + , subq_17.ds__extract_year AS metric_time__extract_year + , subq_17.ds__extract_quarter AS metric_time__extract_quarter + , subq_17.ds__extract_month AS metric_time__extract_month + , subq_17.ds__extract_week AS metric_time__extract_week + , subq_17.ds__extract_day AS metric_time__extract_day + , subq_17.ds__extract_dow AS metric_time__extract_dow + , subq_17.ds__extract_doy AS metric_time__extract_doy , subq_17.listing , subq_17.guest , subq_17.host @@ -554,32 +876,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..a65895e8b1 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , 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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , 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_dow + , subq_5.ds_partitioned__extract_doy + , 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_dow + , subq_5.paid_at__extract_doy + , 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_dow + , subq_5.booking__ds__extract_doy + , 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_dow + , subq_5.booking__ds_partitioned__extract_doy + , 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_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + subq_7.metric_time__day - INTERVAL 14 day = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..5f6ec1ee79 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + subq_22.ds - INTERVAL 14 day = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 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..d6632b499f 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..44cff4ab94 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,26 +36,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.verification__ds__extract_doy , 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_dow + , subq_0.verification__ds_partitioned__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.verification , subq_0.user , subq_0.verification__user @@ -71,22 +106,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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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 +173,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(dow FROM users_ds_source_src_10007.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM users_ds_source_src_10007.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy , 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..33fc914795 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d90abbd294 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..dc98b44d95 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d723157d2a 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..95274f2863 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..e0c877bdf1 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy 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..9c6e0a2676 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..b9ae7f84a4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d1560d9ab0 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , 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..b954d8927e 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -239,32 +379,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b1bf877e84 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..12e006e550 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,36 +51,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -125,32 +174,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +266,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -218,11 +344,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +371,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,26 +450,61 @@ 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_dow + , subq_10.ds__extract_doy , 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_dow + , subq_10.ds_partitioned__extract_doy , 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_dow + , subq_10.view__ds__extract_doy , 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_dow + , subq_10.view__ds_partitioned__extract_doy , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month , subq_10.ds__quarter AS metric_time__quarter , subq_10.ds__year AS metric_time__year + , subq_10.ds__extract_year AS metric_time__extract_year + , subq_10.ds__extract_quarter AS metric_time__extract_quarter + , subq_10.ds__extract_month AS metric_time__extract_month + , subq_10.ds__extract_week AS metric_time__extract_week + , subq_10.ds__extract_day AS metric_time__extract_day + , subq_10.ds__extract_dow AS metric_time__extract_dow + , subq_10.ds__extract_doy AS metric_time__extract_doy , subq_10.listing , subq_10.user , subq_10.view__listing @@ -330,21 +519,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(dow FROM views_source_src_10009.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM views_source_src_10009.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS view__ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy , 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,26 +584,61 @@ 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_dow + , subq_13.ds__extract_doy , 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_dow + , subq_13.created_at__extract_doy , 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_dow + , subq_13.listing__ds__extract_doy , 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_dow + , subq_13.listing__created_at__extract_doy , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month , subq_13.ds__quarter AS metric_time__quarter , subq_13.ds__year AS metric_time__year + , subq_13.ds__extract_year AS metric_time__extract_year + , subq_13.ds__extract_quarter AS metric_time__extract_quarter + , subq_13.ds__extract_month AS metric_time__extract_month + , subq_13.ds__extract_week AS metric_time__extract_week + , subq_13.ds__extract_day AS metric_time__extract_day + , subq_13.ds__extract_dow AS metric_time__extract_dow + , subq_13.ds__extract_doy AS metric_time__extract_doy , subq_13.listing , subq_13.user , subq_13.listing__user @@ -410,11 +662,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +689,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..bcb36633c9 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..cd879426f7 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5b6dd99cc4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..6920a36691 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..4080ab9420 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..fcf74a5947 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,16 +18,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -40,11 +61,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..0143335613 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5cba3a3202 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..414159089b 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5b4011175d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +261,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -244,32 +384,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d11a69936d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b98d6d0f3d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..5b316563f4 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..846598c061 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2ca02e1c57 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +368,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,36 +470,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -369,32 +593,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..f744592adf 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +369,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,36 +471,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -370,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..9a9cd18ee2 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_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , 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_dow AS ds_partitioned__extract_dow + , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_4.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,35 +130,84 @@ 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.metric_time__week AS metric_time__week , subq_1.metric_time__month AS metric_time__month , subq_1.metric_time__quarter AS metric_time__quarter , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_week AS metric_time__extract_week + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -152,36 +243,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -226,32 +366,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d49d04d52c 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,36 +129,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -161,32 +252,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..40f6785af3 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,36 +42,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -116,32 +165,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +257,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -209,11 +335,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +362,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a43457fcbd 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..a3ce23fb89 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..70919d8caa 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,36 +48,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -122,32 +171,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +263,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -215,11 +341,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +368,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..6e4488a729 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 @@ -50,36 +50,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -110,32 +159,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -164,11 +255,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +282,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity 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..9f23719b49 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..cb25d5128e 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2093e49b0b 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..eb506ddf59 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,36 +26,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d5688f0e2d 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,26 +21,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.created_at__extract_doy , 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_dow + , subq_0.listing__ds__extract_doy , 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_dow + , subq_0.listing__created_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.user , subq_0.listing__user @@ -64,11 +99,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +126,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..dbfcb34b94 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e5349b0d17 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,36 +60,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -134,32 +183,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +275,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -227,11 +353,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +380,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +471,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -391,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +686,61 @@ 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_dow + , subq_15.ds__extract_doy , 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_dow + , subq_15.created_at__extract_doy , 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_dow + , subq_15.listing__ds__extract_doy , 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_dow + , subq_15.listing__created_at__extract_doy , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month , subq_15.ds__quarter AS metric_time__quarter , subq_15.ds__year AS metric_time__year + , subq_15.ds__extract_year AS metric_time__extract_year + , subq_15.ds__extract_quarter AS metric_time__extract_quarter + , subq_15.ds__extract_month AS metric_time__extract_month + , subq_15.ds__extract_week AS metric_time__extract_week + , subq_15.ds__extract_day AS metric_time__extract_day + , subq_15.ds__extract_dow AS metric_time__extract_dow + , subq_15.ds__extract_doy AS metric_time__extract_doy , subq_15.listing , subq_15.user , subq_15.listing__user @@ -484,11 +764,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +791,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +865,85 @@ 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_dow + , subq_24.ds__extract_doy , 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_dow + , subq_24.ds_partitioned__extract_doy , 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_dow + , subq_24.paid_at__extract_doy , 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_dow + , subq_24.booking__ds__extract_doy , 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_dow + , subq_24.booking__ds_partitioned__extract_doy , 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_dow + , subq_24.booking__paid_at__extract_doy , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month , subq_24.ds__quarter AS metric_time__quarter , subq_24.ds__year AS metric_time__year + , subq_24.ds__extract_year AS metric_time__extract_year + , subq_24.ds__extract_quarter AS metric_time__extract_quarter + , subq_24.ds__extract_month AS metric_time__extract_month + , subq_24.ds__extract_week AS metric_time__extract_week + , subq_24.ds__extract_day AS metric_time__extract_day + , subq_24.ds__extract_dow AS metric_time__extract_dow + , subq_24.ds__extract_doy AS metric_time__extract_doy , subq_24.listing , subq_24.guest , subq_24.host @@ -631,32 +988,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..61d8df3842 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,36 +45,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -119,32 +168,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +277,85 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.ds_partitioned__extract_doy , 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_dow + , subq_7.paid_at__extract_doy , 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_dow + , subq_7.booking__ds__extract_doy , 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_dow + , subq_7.booking__ds_partitioned__extract_doy , 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_dow + , subq_7.booking__paid_at__extract_doy , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month , subq_7.ds__quarter AS metric_time__quarter , subq_7.ds__year AS metric_time__year + , subq_7.ds__extract_year AS metric_time__extract_year + , subq_7.ds__extract_quarter AS metric_time__extract_quarter + , subq_7.ds__extract_month AS metric_time__extract_month + , subq_7.ds__extract_week AS metric_time__extract_week + , subq_7.ds__extract_day AS metric_time__extract_day + , subq_7.ds__extract_dow AS metric_time__extract_dow + , subq_7.ds__extract_doy AS metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -260,32 +400,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..bd41d48bd9 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,36 +39,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -113,32 +162,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..edfbb1483f 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +251,61 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.created_at__extract_doy , 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_dow + , subq_5.listing__ds__extract_doy , 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_dow + , subq_5.listing__created_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.user , subq_5.listing__user @@ -203,11 +329,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +356,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..79946c1bc1 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -154,26 +245,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_dow AS window_start__extract_dow + , subq_3.window_start__extract_doy AS window_start__extract_doy , 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_dow AS window_end__extract_dow + , subq_3.window_end__extract_doy AS window_end__extract_doy , 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_dow AS listing__window_start__extract_dow + , subq_3.listing__window_start__extract_doy AS listing__window_start__extract_doy , 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_dow AS listing__window_end__extract_dow + , subq_3.listing__window_end__extract_doy AS listing__window_end__extract_doy , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dow AS user__ds__extract_dow + , subq_5.ds__extract_doy AS user__ds__extract_doy , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +318,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +345,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , 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 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +407,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_dow + , subq_4.ds__extract_doy , 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_dow + , subq_4.user__ds__extract_doy , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +437,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(dow FROM users_latest_src_10021.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10021.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS user__ds__extract_doy , 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 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..1cfb7780a7 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -157,11 +248,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_dow AS lux_listing__window_start__extract_dow + , subq_5.window_start__extract_doy AS lux_listing__window_start__extract_doy , 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_dow AS lux_listing__window_end__extract_dow + , subq_5.window_end__extract_doy AS lux_listing__window_end__extract_doy , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +338,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_dow + , subq_4.window_start__extract_doy , 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_dow + , subq_4.window_end__extract_doy , 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_dow + , subq_4.lux_listing__window_start__extract_doy , 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_dow + , subq_4.lux_listing__window_end__extract_doy , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +392,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(dow FROM lux_listings_src_10019.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy , 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(dow FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy , 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 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..7e38380b20 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..0d1825bde4 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,26 +36,61 @@ 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.account_id__ds_partitioned__extract_doy , 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_dow + , subq_0.account_id__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.account_id , subq_0.account_month , subq_0.account_id__account_month @@ -69,22 +104,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(dow FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS ds__extract_doy , 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(dow FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy , 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 +169,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_dow AS ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS account_id__ds_partitioned__extract_dow + , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy , 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_dow AS customer_id__ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy , 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 +216,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(dow FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- '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__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +278,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_dow + , subq_4.ds_partitioned__extract_doy , 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_dow + , subq_4.customer_id__ds_partitioned__extract_doy , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +312,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(dow FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy , 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 +326,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(dow FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy , 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..54b108dd33 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,36 +23,85 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.ds_partitioned__extract_doy , 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_dow + , subq_1.paid_at__extract_doy , 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_dow + , subq_1.booking__ds__extract_doy , 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_dow + , subq_1.booking__ds_partitioned__extract_doy , 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_dow + , subq_1.booking__paid_at__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.listing , subq_1.guest , subq_1.host @@ -82,36 +131,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -156,32 +254,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +357,61 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.created_at__extract_doy , 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_dow + , subq_7.listing__ds__extract_doy , 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_dow + , subq_7.listing__created_at__extract_doy , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month , subq_7.metric_time__quarter , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_week + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.user , subq_7.listing__user @@ -257,26 +432,61 @@ 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_dow + , subq_6.ds__extract_doy , 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_dow + , subq_6.created_at__extract_doy , 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_dow + , subq_6.listing__ds__extract_doy , 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_dow + , subq_6.listing__created_at__extract_doy , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month , subq_6.ds__quarter AS metric_time__quarter , subq_6.ds__year AS metric_time__year + , subq_6.ds__extract_year AS metric_time__extract_year + , subq_6.ds__extract_quarter AS metric_time__extract_quarter + , subq_6.ds__extract_month AS metric_time__extract_month + , subq_6.ds__extract_week AS metric_time__extract_week + , subq_6.ds__extract_day AS metric_time__extract_day + , subq_6.ds__extract_dow AS metric_time__extract_dow + , subq_6.ds__extract_doy AS metric_time__extract_doy , subq_6.listing , subq_6.user , subq_6.listing__user @@ -300,11 +510,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +537,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a716977aaf 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,36 +44,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -118,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +273,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -256,32 +396,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +514,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -406,32 +637,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +753,85 @@ 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_dow + , subq_17.ds__extract_doy , 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_dow + , subq_17.ds_partitioned__extract_doy , 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_dow + , subq_17.paid_at__extract_doy , 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_dow + , subq_17.booking__ds__extract_doy , 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_dow + , subq_17.booking__ds_partitioned__extract_doy , 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_dow + , subq_17.booking__paid_at__extract_doy , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month , subq_17.ds__quarter AS metric_time__quarter , subq_17.ds__year AS metric_time__year + , subq_17.ds__extract_year AS metric_time__extract_year + , subq_17.ds__extract_quarter AS metric_time__extract_quarter + , subq_17.ds__extract_month AS metric_time__extract_month + , subq_17.ds__extract_week AS metric_time__extract_week + , subq_17.ds__extract_day AS metric_time__extract_day + , subq_17.ds__extract_dow AS metric_time__extract_dow + , subq_17.ds__extract_doy AS metric_time__extract_doy , subq_17.listing , subq_17.guest , subq_17.host @@ -554,32 +876,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..17b1104b28 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , 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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , 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_dow + , subq_5.ds_partitioned__extract_doy + , 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_dow + , subq_5.paid_at__extract_doy + , 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_dow + , subq_5.booking__ds__extract_doy + , 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_dow + , subq_5.booking__ds_partitioned__extract_doy + , 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_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + subq_7.metric_time__day - MAKE_INTERVAL(days => 14) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..0ddba9f210 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 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..d6632b499f 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..44cff4ab94 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,26 +36,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.verification__ds__extract_doy , 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_dow + , subq_0.verification__ds_partitioned__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.verification , subq_0.user , subq_0.verification__user @@ -71,22 +106,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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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 +173,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(dow FROM users_ds_source_src_10007.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM users_ds_source_src_10007.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy , 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..33fc914795 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d90abbd294 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..dc98b44d95 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d723157d2a 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..95274f2863 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..e0c877bdf1 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy 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..9c6e0a2676 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..b9ae7f84a4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d1560d9ab0 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , 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..b954d8927e 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -239,32 +379,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b1bf877e84 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..12e006e550 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,36 +51,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -125,32 +174,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +266,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -218,11 +344,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +371,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,26 +450,61 @@ 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_dow + , subq_10.ds__extract_doy , 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_dow + , subq_10.ds_partitioned__extract_doy , 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_dow + , subq_10.view__ds__extract_doy , 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_dow + , subq_10.view__ds_partitioned__extract_doy , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month , subq_10.ds__quarter AS metric_time__quarter , subq_10.ds__year AS metric_time__year + , subq_10.ds__extract_year AS metric_time__extract_year + , subq_10.ds__extract_quarter AS metric_time__extract_quarter + , subq_10.ds__extract_month AS metric_time__extract_month + , subq_10.ds__extract_week AS metric_time__extract_week + , subq_10.ds__extract_day AS metric_time__extract_day + , subq_10.ds__extract_dow AS metric_time__extract_dow + , subq_10.ds__extract_doy AS metric_time__extract_doy , subq_10.listing , subq_10.user , subq_10.view__listing @@ -330,21 +519,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(dow FROM views_source_src_10009.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM views_source_src_10009.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS view__ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy , 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,26 +584,61 @@ 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_dow + , subq_13.ds__extract_doy , 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_dow + , subq_13.created_at__extract_doy , 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_dow + , subq_13.listing__ds__extract_doy , 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_dow + , subq_13.listing__created_at__extract_doy , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month , subq_13.ds__quarter AS metric_time__quarter , subq_13.ds__year AS metric_time__year + , subq_13.ds__extract_year AS metric_time__extract_year + , subq_13.ds__extract_quarter AS metric_time__extract_quarter + , subq_13.ds__extract_month AS metric_time__extract_month + , subq_13.ds__extract_week AS metric_time__extract_week + , subq_13.ds__extract_day AS metric_time__extract_day + , subq_13.ds__extract_dow AS metric_time__extract_dow + , subq_13.ds__extract_doy AS metric_time__extract_doy , subq_13.listing , subq_13.user , subq_13.listing__user @@ -410,11 +662,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +689,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..bcb36633c9 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..cd879426f7 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5b6dd99cc4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..6920a36691 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..4080ab9420 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..fcf74a5947 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,16 +18,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -40,11 +61,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..0143335613 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5cba3a3202 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..414159089b 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5b4011175d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +261,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -244,32 +384,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d11a69936d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b98d6d0f3d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..9139bc862d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..0022a4f526 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..10bb6c0450 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +368,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,36 +470,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -369,32 +593,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..1aaa96b40a 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +369,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,36 +471,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -370,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..3107752f3d 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_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , 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_dow AS ds_partitioned__extract_dow + , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_4.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,35 +130,84 @@ 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.metric_time__week AS metric_time__week , subq_1.metric_time__month AS metric_time__month , subq_1.metric_time__quarter AS metric_time__quarter , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_week AS metric_time__extract_week + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -152,36 +243,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -226,32 +366,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..666e2d3376 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,36 +129,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -161,32 +252,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..40f6785af3 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,36 +42,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -116,32 +165,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +257,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -209,11 +335,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +362,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a43457fcbd 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..a3ce23fb89 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..70919d8caa 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,36 +48,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -122,32 +171,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +263,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -215,11 +341,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +368,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..6e4488a729 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 @@ -50,36 +50,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -110,32 +159,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -164,11 +255,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +282,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity 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..9f23719b49 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..1c6b0467ff 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2093e49b0b 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..eb506ddf59 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,36 +26,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d5688f0e2d 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,26 +21,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.created_at__extract_doy , 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_dow + , subq_0.listing__ds__extract_doy , 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_dow + , subq_0.listing__created_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.user , subq_0.listing__user @@ -64,11 +99,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +126,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..dbfcb34b94 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e5349b0d17 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,36 +60,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -134,32 +183,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +275,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -227,11 +353,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +380,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +471,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -391,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +686,61 @@ 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_dow + , subq_15.ds__extract_doy , 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_dow + , subq_15.created_at__extract_doy , 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_dow + , subq_15.listing__ds__extract_doy , 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_dow + , subq_15.listing__created_at__extract_doy , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month , subq_15.ds__quarter AS metric_time__quarter , subq_15.ds__year AS metric_time__year + , subq_15.ds__extract_year AS metric_time__extract_year + , subq_15.ds__extract_quarter AS metric_time__extract_quarter + , subq_15.ds__extract_month AS metric_time__extract_month + , subq_15.ds__extract_week AS metric_time__extract_week + , subq_15.ds__extract_day AS metric_time__extract_day + , subq_15.ds__extract_dow AS metric_time__extract_dow + , subq_15.ds__extract_doy AS metric_time__extract_doy , subq_15.listing , subq_15.user , subq_15.listing__user @@ -484,11 +764,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +791,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +865,85 @@ 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_dow + , subq_24.ds__extract_doy , 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_dow + , subq_24.ds_partitioned__extract_doy , 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_dow + , subq_24.paid_at__extract_doy , 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_dow + , subq_24.booking__ds__extract_doy , 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_dow + , subq_24.booking__ds_partitioned__extract_doy , 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_dow + , subq_24.booking__paid_at__extract_doy , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month , subq_24.ds__quarter AS metric_time__quarter , subq_24.ds__year AS metric_time__year + , subq_24.ds__extract_year AS metric_time__extract_year + , subq_24.ds__extract_quarter AS metric_time__extract_quarter + , subq_24.ds__extract_month AS metric_time__extract_month + , subq_24.ds__extract_week AS metric_time__extract_week + , subq_24.ds__extract_day AS metric_time__extract_day + , subq_24.ds__extract_dow AS metric_time__extract_dow + , subq_24.ds__extract_doy AS metric_time__extract_doy , subq_24.listing , subq_24.guest , subq_24.host @@ -631,32 +988,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..61d8df3842 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,36 +45,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -119,32 +168,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +277,85 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.ds_partitioned__extract_doy , 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_dow + , subq_7.paid_at__extract_doy , 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_dow + , subq_7.booking__ds__extract_doy , 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_dow + , subq_7.booking__ds_partitioned__extract_doy , 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_dow + , subq_7.booking__paid_at__extract_doy , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month , subq_7.ds__quarter AS metric_time__quarter , subq_7.ds__year AS metric_time__year + , subq_7.ds__extract_year AS metric_time__extract_year + , subq_7.ds__extract_quarter AS metric_time__extract_quarter + , subq_7.ds__extract_month AS metric_time__extract_month + , subq_7.ds__extract_week AS metric_time__extract_week + , subq_7.ds__extract_day AS metric_time__extract_day + , subq_7.ds__extract_dow AS metric_time__extract_dow + , subq_7.ds__extract_doy AS metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -260,32 +400,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..bd41d48bd9 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,36 +39,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -113,32 +162,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..edfbb1483f 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +251,61 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.created_at__extract_doy , 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_dow + , subq_5.listing__ds__extract_doy , 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_dow + , subq_5.listing__created_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.user , subq_5.listing__user @@ -203,11 +329,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +356,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..79946c1bc1 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -154,26 +245,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_dow AS window_start__extract_dow + , subq_3.window_start__extract_doy AS window_start__extract_doy , 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_dow AS window_end__extract_dow + , subq_3.window_end__extract_doy AS window_end__extract_doy , 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_dow AS listing__window_start__extract_dow + , subq_3.listing__window_start__extract_doy AS listing__window_start__extract_doy , 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_dow AS listing__window_end__extract_dow + , subq_3.listing__window_end__extract_doy AS listing__window_end__extract_doy , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dow AS user__ds__extract_dow + , subq_5.ds__extract_doy AS user__ds__extract_doy , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +318,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +345,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , 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 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +407,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_dow + , subq_4.ds__extract_doy , 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_dow + , subq_4.user__ds__extract_doy , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +437,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(dow FROM users_latest_src_10021.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10021.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS user__ds__extract_doy , 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 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..1cfb7780a7 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -157,11 +248,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_dow AS lux_listing__window_start__extract_dow + , subq_5.window_start__extract_doy AS lux_listing__window_start__extract_doy , 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_dow AS lux_listing__window_end__extract_dow + , subq_5.window_end__extract_doy AS lux_listing__window_end__extract_doy , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +338,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_dow + , subq_4.window_start__extract_doy , 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_dow + , subq_4.window_end__extract_doy , 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_dow + , subq_4.lux_listing__window_start__extract_doy , 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_dow + , subq_4.lux_listing__window_end__extract_doy , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +392,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(dow FROM lux_listings_src_10019.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy , 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(dow FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy , 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 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..7e38380b20 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..0d1825bde4 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,26 +36,61 @@ 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.account_id__ds_partitioned__extract_doy , 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_dow + , subq_0.account_id__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.account_id , subq_0.account_month , subq_0.account_id__account_month @@ -69,22 +104,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(dow FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS ds__extract_doy , 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(dow FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy , 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 +169,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_dow AS ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS account_id__ds_partitioned__extract_dow + , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy , 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_dow AS customer_id__ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy , 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 +216,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(dow FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- '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__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +278,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_dow + , subq_4.ds_partitioned__extract_doy , 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_dow + , subq_4.customer_id__ds_partitioned__extract_doy , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +312,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(dow FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy , 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 +326,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(dow FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy , 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..54b108dd33 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,36 +23,85 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.ds_partitioned__extract_doy , 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_dow + , subq_1.paid_at__extract_doy , 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_dow + , subq_1.booking__ds__extract_doy , 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_dow + , subq_1.booking__ds_partitioned__extract_doy , 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_dow + , subq_1.booking__paid_at__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.listing , subq_1.guest , subq_1.host @@ -82,36 +131,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -156,32 +254,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +357,61 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.created_at__extract_doy , 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_dow + , subq_7.listing__ds__extract_doy , 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_dow + , subq_7.listing__created_at__extract_doy , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month , subq_7.metric_time__quarter , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_week + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.user , subq_7.listing__user @@ -257,26 +432,61 @@ 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_dow + , subq_6.ds__extract_doy , 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_dow + , subq_6.created_at__extract_doy , 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_dow + , subq_6.listing__ds__extract_doy , 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_dow + , subq_6.listing__created_at__extract_doy , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month , subq_6.ds__quarter AS metric_time__quarter , subq_6.ds__year AS metric_time__year + , subq_6.ds__extract_year AS metric_time__extract_year + , subq_6.ds__extract_quarter AS metric_time__extract_quarter + , subq_6.ds__extract_month AS metric_time__extract_month + , subq_6.ds__extract_week AS metric_time__extract_week + , subq_6.ds__extract_day AS metric_time__extract_day + , subq_6.ds__extract_dow AS metric_time__extract_dow + , subq_6.ds__extract_doy AS metric_time__extract_doy , subq_6.listing , subq_6.user , subq_6.listing__user @@ -300,11 +510,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +537,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a716977aaf 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,36 +44,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -118,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +273,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -256,32 +396,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +514,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -406,32 +637,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +753,85 @@ 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_dow + , subq_17.ds__extract_doy , 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_dow + , subq_17.ds_partitioned__extract_doy , 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_dow + , subq_17.paid_at__extract_doy , 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_dow + , subq_17.booking__ds__extract_doy , 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_dow + , subq_17.booking__ds_partitioned__extract_doy , 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_dow + , subq_17.booking__paid_at__extract_doy , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month , subq_17.ds__quarter AS metric_time__quarter , subq_17.ds__year AS metric_time__year + , subq_17.ds__extract_year AS metric_time__extract_year + , subq_17.ds__extract_quarter AS metric_time__extract_quarter + , subq_17.ds__extract_month AS metric_time__extract_month + , subq_17.ds__extract_week AS metric_time__extract_week + , subq_17.ds__extract_day AS metric_time__extract_day + , subq_17.ds__extract_dow AS metric_time__extract_dow + , subq_17.ds__extract_doy AS metric_time__extract_doy , subq_17.listing , subq_17.guest , subq_17.host @@ -554,32 +876,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..68e1d3302c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , 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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , 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_dow + , subq_5.ds_partitioned__extract_doy + , 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_dow + , subq_5.paid_at__extract_doy + , 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_dow + , subq_5.booking__ds__extract_doy + , 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_dow + , subq_5.booking__ds_partitioned__extract_doy + , 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_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..d1a408e031 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 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..d6632b499f 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..44cff4ab94 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,26 +36,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.verification__ds__extract_doy , 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_dow + , subq_0.verification__ds_partitioned__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.verification , subq_0.user , subq_0.verification__user @@ -71,22 +106,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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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 +173,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(dow FROM users_ds_source_src_10007.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM users_ds_source_src_10007.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy , 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..33fc914795 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d90abbd294 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..dc98b44d95 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d723157d2a 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..95274f2863 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..e0c877bdf1 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy 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..9c6e0a2676 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..b9ae7f84a4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d1560d9ab0 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , 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..b954d8927e 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -239,32 +379,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b1bf877e84 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5373f3b9a9 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,36 +51,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -125,32 +174,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +266,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -218,11 +344,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +371,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,26 +450,61 @@ 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_dow + , subq_10.ds__extract_doy , 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_dow + , subq_10.ds_partitioned__extract_doy , 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_dow + , subq_10.view__ds__extract_doy , 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_dow + , subq_10.view__ds_partitioned__extract_doy , subq_10.ds__day AS metric_time__day , subq_10.ds__week AS metric_time__week , subq_10.ds__month AS metric_time__month , subq_10.ds__quarter AS metric_time__quarter , subq_10.ds__year AS metric_time__year + , subq_10.ds__extract_year AS metric_time__extract_year + , subq_10.ds__extract_quarter AS metric_time__extract_quarter + , subq_10.ds__extract_month AS metric_time__extract_month + , subq_10.ds__extract_week AS metric_time__extract_week + , subq_10.ds__extract_day AS metric_time__extract_day + , subq_10.ds__extract_dow AS metric_time__extract_dow + , subq_10.ds__extract_doy AS metric_time__extract_doy , subq_10.listing , subq_10.user , subq_10.view__listing @@ -330,21 +519,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(dow FROM views_source_src_10009.ds) AS ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM views_source_src_10009.ds) AS view__ds__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds) AS view__ds__extract_doy , 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(dow FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(doy FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy , 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,26 +584,61 @@ 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_dow + , subq_13.ds__extract_doy , 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_dow + , subq_13.created_at__extract_doy , 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_dow + , subq_13.listing__ds__extract_doy , 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_dow + , subq_13.listing__created_at__extract_doy , subq_13.ds__day AS metric_time__day , subq_13.ds__week AS metric_time__week , subq_13.ds__month AS metric_time__month , subq_13.ds__quarter AS metric_time__quarter , subq_13.ds__year AS metric_time__year + , subq_13.ds__extract_year AS metric_time__extract_year + , subq_13.ds__extract_quarter AS metric_time__extract_quarter + , subq_13.ds__extract_month AS metric_time__extract_month + , subq_13.ds__extract_week AS metric_time__extract_week + , subq_13.ds__extract_day AS metric_time__extract_day + , subq_13.ds__extract_dow AS metric_time__extract_dow + , subq_13.ds__extract_doy AS metric_time__extract_doy , subq_13.listing , subq_13.user , subq_13.listing__user @@ -410,11 +662,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +689,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..1bd176c115 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..cd879426f7 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..5b6dd99cc4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..6920a36691 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..4080ab9420 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..fcf74a5947 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,16 +18,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -40,11 +61,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..0143335613 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,16 +21,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -43,11 +64,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5cba3a3202 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..414159089b 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,16 +21,37 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.company__ds__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.user , subq_1.company__user , subq_1.txn_revenue @@ -42,16 +63,37 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.company__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.user , subq_0.company__user , subq_0.txn_revenue @@ -64,11 +106,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(dow FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS ds__extract_doy , 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(dow FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(doy FROM revenue_src_10006.created_at) AS company__ds__extract_doy , 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..5b4011175d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +261,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -244,32 +384,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d11a69936d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..b98d6d0f3d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..9139bc862d 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..0022a4f526 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,36 +32,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -106,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +262,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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host @@ -231,36 +364,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -305,32 +487,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..10bb6c0450 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +368,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -295,36 +470,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -369,32 +593,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..1aaa96b40a 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -93,36 +135,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -167,32 +258,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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 +369,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_dow AS ds__extract_dow + , subq_9.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_9.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host @@ -296,36 +471,85 @@ 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_dow + , subq_8.ds__extract_doy , 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_dow + , subq_8.ds_partitioned__extract_doy , 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_dow + , subq_8.paid_at__extract_doy , 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_dow + , subq_8.booking__ds__extract_doy , 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_dow + , subq_8.booking__ds_partitioned__extract_doy , 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_dow + , subq_8.booking__paid_at__extract_doy , subq_8.ds__day AS metric_time__day , subq_8.ds__week AS metric_time__week , subq_8.ds__month AS metric_time__month , subq_8.ds__quarter AS metric_time__quarter , subq_8.ds__year AS metric_time__year + , subq_8.ds__extract_year AS metric_time__extract_year + , subq_8.ds__extract_quarter AS metric_time__extract_quarter + , subq_8.ds__extract_month AS metric_time__extract_month + , subq_8.ds__extract_week AS metric_time__extract_week + , subq_8.ds__extract_day AS metric_time__extract_day + , subq_8.ds__extract_dow AS metric_time__extract_dow + , subq_8.ds__extract_doy AS metric_time__extract_doy , subq_8.listing , subq_8.guest , subq_8.host @@ -370,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..3107752f3d 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_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter , 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_dow AS ds_partitioned__extract_dow + , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_4.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy , 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_dow AS booking__ds_partitioned__extract_dow + , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_4.listing AS listing , subq_4.guest AS guest , subq_4.host AS host @@ -88,35 +130,84 @@ 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.metric_time__week AS metric_time__week , subq_1.metric_time__month AS metric_time__month , subq_1.metric_time__quarter AS metric_time__quarter , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_week AS metric_time__extract_week + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -152,36 +243,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -226,32 +366,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..666e2d3376 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_dow AS ds__extract_dow + , subq_1.ds__extract_doy AS ds__extract_doy , 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_dow AS ds_partitioned__extract_dow + , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS paid_at__extract_dow + , subq_1.paid_at__extract_doy AS paid_at__extract_doy , 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_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month , 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_dow AS booking__ds_partitioned__extract_dow + , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy , 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_dow AS booking__paid_at__extract_dow + , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -87,36 +129,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -161,32 +252,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..40f6785af3 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,36 +42,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -116,32 +165,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +257,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -209,11 +335,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +362,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a43457fcbd 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..a3ce23fb89 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..70919d8caa 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,36 +48,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -122,32 +171,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +263,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -215,11 +341,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +368,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..6e4488a729 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 @@ -50,36 +50,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -110,32 +159,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -164,11 +255,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -177,11 +282,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity 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..9f23719b49 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..1c6b0467ff 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2093e49b0b 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,36 +37,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -111,32 +160,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..eb506ddf59 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,36 +26,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d5688f0e2d 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,26 +21,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.created_at__extract_doy , 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_dow + , subq_0.listing__ds__extract_doy , 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_dow + , subq_0.listing__created_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.user , subq_0.listing__user @@ -64,11 +99,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +126,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..dbfcb34b94 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e5349b0d17 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,36 +60,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -134,32 +183,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +275,61 @@ 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_dow + , subq_3.ds__extract_doy , subq_3.created_at__day , subq_3.created_at__week , subq_3.created_at__month , subq_3.created_at__quarter , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_week + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy , 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_dow + , subq_3.listing__ds__extract_doy , 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_dow + , subq_3.listing__created_at__extract_doy , subq_3.ds__day AS metric_time__day , subq_3.ds__week AS metric_time__week , subq_3.ds__month AS metric_time__month , subq_3.ds__quarter AS metric_time__quarter , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_week AS metric_time__extract_week + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy , subq_3.listing , subq_3.user , subq_3.listing__user @@ -227,11 +353,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +380,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +471,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -391,32 +594,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +686,61 @@ 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_dow + , subq_15.ds__extract_doy , 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_dow + , subq_15.created_at__extract_doy , 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_dow + , subq_15.listing__ds__extract_doy , 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_dow + , subq_15.listing__created_at__extract_doy , subq_15.ds__day AS metric_time__day , subq_15.ds__week AS metric_time__week , subq_15.ds__month AS metric_time__month , subq_15.ds__quarter AS metric_time__quarter , subq_15.ds__year AS metric_time__year + , subq_15.ds__extract_year AS metric_time__extract_year + , subq_15.ds__extract_quarter AS metric_time__extract_quarter + , subq_15.ds__extract_month AS metric_time__extract_month + , subq_15.ds__extract_week AS metric_time__extract_week + , subq_15.ds__extract_day AS metric_time__extract_day + , subq_15.ds__extract_dow AS metric_time__extract_dow + , subq_15.ds__extract_doy AS metric_time__extract_doy , subq_15.listing , subq_15.user , subq_15.listing__user @@ -484,11 +764,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +791,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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,36 +865,85 @@ 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_dow + , subq_24.ds__extract_doy , 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_dow + , subq_24.ds_partitioned__extract_doy , 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_dow + , subq_24.paid_at__extract_doy , 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_dow + , subq_24.booking__ds__extract_doy , 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_dow + , subq_24.booking__ds_partitioned__extract_doy , 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_dow + , subq_24.booking__paid_at__extract_doy , subq_24.ds__day AS metric_time__day , subq_24.ds__week AS metric_time__week , subq_24.ds__month AS metric_time__month , subq_24.ds__quarter AS metric_time__quarter , subq_24.ds__year AS metric_time__year + , subq_24.ds__extract_year AS metric_time__extract_year + , subq_24.ds__extract_quarter AS metric_time__extract_quarter + , subq_24.ds__extract_month AS metric_time__extract_month + , subq_24.ds__extract_week AS metric_time__extract_week + , subq_24.ds__extract_day AS metric_time__extract_day + , subq_24.ds__extract_dow AS metric_time__extract_dow + , subq_24.ds__extract_doy AS metric_time__extract_doy , subq_24.listing , subq_24.guest , subq_24.host @@ -631,32 +988,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c11754db0d 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,36 +45,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -119,32 +168,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +277,85 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.ds_partitioned__extract_doy , 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_dow + , subq_7.paid_at__extract_doy , 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_dow + , subq_7.booking__ds__extract_doy , 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_dow + , subq_7.booking__ds_partitioned__extract_doy , 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_dow + , subq_7.booking__paid_at__extract_doy , subq_7.ds__day AS metric_time__day , subq_7.ds__week AS metric_time__week , subq_7.ds__month AS metric_time__month , subq_7.ds__quarter AS metric_time__quarter , subq_7.ds__year AS metric_time__year + , subq_7.ds__extract_year AS metric_time__extract_year + , subq_7.ds__extract_quarter AS metric_time__extract_quarter + , subq_7.ds__extract_month AS metric_time__extract_month + , subq_7.ds__extract_week AS metric_time__extract_week + , subq_7.ds__extract_day AS metric_time__extract_day + , subq_7.ds__extract_dow AS metric_time__extract_dow + , subq_7.ds__extract_doy AS metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -260,32 +400,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..bd41d48bd9 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,36 +39,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -113,32 +162,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..ecc15101fe 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +251,61 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.created_at__extract_doy , 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_dow + , subq_5.listing__ds__extract_doy , 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_dow + , subq_5.listing__created_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.user , subq_5.listing__user @@ -203,11 +329,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +356,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..79946c1bc1 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -154,26 +245,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_dow AS window_start__extract_dow + , subq_3.window_start__extract_doy AS window_start__extract_doy , 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_dow AS window_end__extract_dow + , subq_3.window_end__extract_doy AS window_end__extract_doy , 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_dow AS listing__window_start__extract_dow + , subq_3.listing__window_start__extract_doy AS listing__window_start__extract_doy , 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_dow AS listing__window_end__extract_dow + , subq_3.listing__window_end__extract_doy AS listing__window_end__extract_doy , subq_5.ds__day AS user__ds__day , subq_5.ds__week AS user__ds__week , subq_5.ds__month AS user__ds__month , subq_5.ds__quarter AS user__ds__quarter , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_week AS user__ds__extract_week + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dow AS user__ds__extract_dow + , subq_5.ds__extract_doy AS user__ds__extract_doy , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -192,11 +318,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(dow FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -205,11 +345,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(dow FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , 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(dow FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(doy FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , 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 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day @@ -239,11 +407,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_dow + , subq_4.ds__extract_doy , 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_dow + , subq_4.user__ds__extract_doy , subq_4.user , subq_4.home_state_latest , subq_4.user__home_state_latest @@ -255,12 +437,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(dow FROM users_latest_src_10021.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS ds__extract_doy , 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(dow FROM users_latest_src_10021.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_latest_src_10021.ds) AS user__ds__extract_doy , 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 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..1cfb7780a7 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 @@ -40,36 +40,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -100,32 +149,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(dow FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , 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(dow FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , 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(dow FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -157,11 +248,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_dow AS lux_listing__window_start__extract_dow + , subq_5.window_start__extract_doy AS lux_listing__window_start__extract_doy , 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_dow AS lux_listing__window_end__extract_dow + , subq_5.window_end__extract_doy AS lux_listing__window_end__extract_doy , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing @@ -183,21 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- '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__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -205,21 +338,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_dow + , subq_4.window_start__extract_doy , 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_dow + , subq_4.window_end__extract_doy , 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_dow + , subq_4.lux_listing__window_start__extract_doy , 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_dow + , subq_4.lux_listing__window_end__extract_doy , subq_4.lux_listing , subq_4.is_confirmed_lux , subq_4.lux_listing__is_confirmed_lux @@ -231,22 +392,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(dow FROM lux_listings_src_10019.valid_from) AS window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy , 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(dow FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy , 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(dow FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(doy FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy , 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 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..7e38380b20 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..0d1825bde4 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,26 +36,61 @@ 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.account_id__ds_partitioned__extract_doy , 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_dow + , subq_0.account_id__ds__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.account_id , subq_0.account_month , subq_0.account_id__account_month @@ -69,22 +104,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(dow FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS ds__extract_doy , 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(dow FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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(dow FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dow + , EXTRACT(doy FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy , 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 +169,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_dow AS ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy AS ds_partitioned__extract_doy , 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_dow AS account_id__ds_partitioned__extract_dow + , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy , 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_dow AS customer_id__ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy , 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 +216,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(dow FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy , 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 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- '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__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -166,11 +278,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_dow + , subq_4.ds_partitioned__extract_doy , 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_dow + , subq_4.customer_id__ds_partitioned__extract_doy , subq_4.customer_id , subq_4.customer_name , subq_4.customer_atomic_weight @@ -186,6 +312,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(dow FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy , 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 +326,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(dow FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(doy FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy , 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..54b108dd33 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,36 +23,85 @@ 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_dow + , subq_1.ds__extract_doy , 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_dow + , subq_1.ds_partitioned__extract_doy , 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_dow + , subq_1.paid_at__extract_doy , 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_dow + , subq_1.booking__ds__extract_doy , 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_dow + , subq_1.booking__ds_partitioned__extract_doy , 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_dow + , subq_1.booking__paid_at__extract_doy , subq_1.metric_time__day , subq_1.metric_time__week , subq_1.metric_time__month , subq_1.metric_time__quarter , subq_1.metric_time__year + , subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy , subq_1.listing , subq_1.guest , subq_1.host @@ -82,36 +131,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -156,32 +254,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,26 +357,61 @@ 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_dow + , subq_7.ds__extract_doy , 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_dow + , subq_7.created_at__extract_doy , 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_dow + , subq_7.listing__ds__extract_doy , 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_dow + , subq_7.listing__created_at__extract_doy , subq_7.metric_time__day , subq_7.metric_time__week , subq_7.metric_time__month , subq_7.metric_time__quarter , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_week + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.user , subq_7.listing__user @@ -257,26 +432,61 @@ 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_dow + , subq_6.ds__extract_doy , 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_dow + , subq_6.created_at__extract_doy , 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_dow + , subq_6.listing__ds__extract_doy , 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_dow + , subq_6.listing__created_at__extract_doy , subq_6.ds__day AS metric_time__day , subq_6.ds__week AS metric_time__week , subq_6.ds__month AS metric_time__month , subq_6.ds__quarter AS metric_time__quarter , subq_6.ds__year AS metric_time__year + , subq_6.ds__extract_year AS metric_time__extract_year + , subq_6.ds__extract_quarter AS metric_time__extract_quarter + , subq_6.ds__extract_month AS metric_time__extract_month + , subq_6.ds__extract_week AS metric_time__extract_week + , subq_6.ds__extract_day AS metric_time__extract_day + , subq_6.ds__extract_dow AS metric_time__extract_dow + , subq_6.ds__extract_doy AS metric_time__extract_doy , subq_6.listing , subq_6.user , subq_6.listing__user @@ -300,11 +510,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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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 +537,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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..a716977aaf 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,36 +44,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -118,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +273,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , subq_5.ds__day AS metric_time__day , subq_5.ds__week AS metric_time__week , subq_5.ds__month AS metric_time__month , subq_5.ds__quarter AS metric_time__quarter , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -256,32 +396,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +514,85 @@ 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_dow + , subq_12.ds__extract_doy , 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_dow + , subq_12.ds_partitioned__extract_doy , 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_dow + , subq_12.paid_at__extract_doy , 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_dow + , subq_12.booking__ds__extract_doy , 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_dow + , subq_12.booking__ds_partitioned__extract_doy , 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_dow + , subq_12.booking__paid_at__extract_doy , subq_12.ds__day AS metric_time__day , subq_12.ds__week AS metric_time__week , subq_12.ds__month AS metric_time__month , subq_12.ds__quarter AS metric_time__quarter , subq_12.ds__year AS metric_time__year + , subq_12.ds__extract_year AS metric_time__extract_year + , subq_12.ds__extract_quarter AS metric_time__extract_quarter + , subq_12.ds__extract_month AS metric_time__extract_month + , subq_12.ds__extract_week AS metric_time__extract_week + , subq_12.ds__extract_day AS metric_time__extract_day + , subq_12.ds__extract_dow AS metric_time__extract_dow + , subq_12.ds__extract_doy AS metric_time__extract_doy , subq_12.listing , subq_12.guest , subq_12.host @@ -406,32 +637,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +753,85 @@ 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_dow + , subq_17.ds__extract_doy , 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_dow + , subq_17.ds_partitioned__extract_doy , 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_dow + , subq_17.paid_at__extract_doy , 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_dow + , subq_17.booking__ds__extract_doy , 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_dow + , subq_17.booking__ds_partitioned__extract_doy , 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_dow + , subq_17.booking__paid_at__extract_doy , subq_17.ds__day AS metric_time__day , subq_17.ds__week AS metric_time__week , subq_17.ds__month AS metric_time__month , subq_17.ds__quarter AS metric_time__quarter , subq_17.ds__year AS metric_time__year + , subq_17.ds__extract_year AS metric_time__extract_year + , subq_17.ds__extract_quarter AS metric_time__extract_quarter + , subq_17.ds__extract_month AS metric_time__extract_month + , subq_17.ds__extract_week AS metric_time__extract_week + , subq_17.ds__extract_day AS metric_time__extract_day + , subq_17.ds__extract_dow AS metric_time__extract_dow + , subq_17.ds__extract_doy AS metric_time__extract_doy , subq_17.listing , subq_17.guest , subq_17.host @@ -554,32 +876,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..68e1d3302c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , 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_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , 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_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , 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_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , 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_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , 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_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , 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_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , 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_dow + , subq_5.ds_partitioned__extract_doy + , 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_dow + , subq_5.paid_at__extract_doy + , 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_dow + , subq_5.booking__ds__extract_doy + , 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_dow + , subq_5.booking__ds_partitioned__extract_doy + , 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_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..d1a408e031 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 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..d6632b499f 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..44cff4ab94 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,26 +36,61 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.verification__ds__extract_doy , 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_dow + , subq_0.verification__ds_partitioned__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.verification , subq_0.user , subq_0.verification__user @@ -71,22 +106,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(dow FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , 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(dow FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(doy FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , 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 +173,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(dow FROM users_ds_source_src_10007.ds) AS ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM users_ds_source_src_10007.ds) AS user__ds__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy , 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(dow FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy , 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(dow FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(doy FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy , 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..33fc914795 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d90abbd294 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..dc98b44d95 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..d723157d2a 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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..95274f2863 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_dow AS ds__extract_dow + , subq_0.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_0.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS ds__extract_doy , 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(dow FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , 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..e0c877bdf1 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_dow AS ds__extract_dow + , subq_3.ds__extract_doy AS ds__extract_doy , 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_dow AS account__ds__extract_dow + , subq_3.account__ds__extract_doy AS account__ds__extract_doy , 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds) AS account__ds__extract_dow + , EXTRACT(doy FROM ds) AS account__ds__extract_doy , 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_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + 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_dow + , subq_0.ds__extract_doy + , 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_dow + , subq_0.ds_partitioned__extract_doy + , 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_dow + , subq_0.paid_at__extract_doy + , 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_dow + , subq_0.booking__ds__extract_doy + , 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_dow + , subq_0.booking__ds_partitioned__extract_doy + , 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_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy 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..9c6e0a2676 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , 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(dow FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , 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..b9ae7f84a4 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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..d1560d9ab0 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , 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..d5208d36cf 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -313,27 +509,27 @@ - + - + - + - + - + - + @@ -341,31 +537,31 @@ - + - + - + - + - + - + - + @@ -383,133 +579,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -528,11 +892,11 @@ - + - + @@ -541,7 +905,7 @@ - + @@ -550,7 +914,7 @@ - + @@ -560,11 +924,11 @@ - + - + @@ -573,227 +937,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -810,27 +1370,27 @@ - + - + - + - + - + - + @@ -838,31 +1398,31 @@ - + - + - + - + - + - + - + @@ -880,133 +1440,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..2660580f8d 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..543c84a88f 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -392,27 +588,27 @@ - + - + - + - + - + - + @@ -420,31 +616,31 @@ - + - + - + - + - + - + - + @@ -462,133 +658,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -607,11 +971,11 @@ - + - + @@ -620,172 +984,312 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + @@ -803,101 +1307,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + @@ -918,15 +1534,15 @@ - + - + - + @@ -935,11 +1551,11 @@ - + - + @@ -948,11 +1564,11 @@ - + - + @@ -962,15 +1578,15 @@ - + - + - + @@ -979,19 +1595,19 @@ - + - + - + - + @@ -1008,15 +1624,15 @@ - + - + - + @@ -1025,123 +1641,263 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1154,7 +1910,7 @@ - + @@ -1172,81 +1928,193 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -1265,11 +2133,11 @@ - + - + @@ -1278,151 +2146,291 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1435,15 +2443,15 @@ - + - + - + @@ -1461,101 +2469,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..9caab95d18 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..5510083da3 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..6832ab1d88 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..6a4f2968b1 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,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126,11 +210,11 @@ - + - + @@ -148,33 +232,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..05e69c0c94 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,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126,11 +210,11 @@ - + - + @@ -148,33 +232,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..c44152f685 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,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -110,11 +194,11 @@ - + - + @@ -132,33 +216,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..c246fb55db 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,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126,11 +210,11 @@ - + - + @@ -148,33 +232,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..11c4a6ef28 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,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -127,75 +211,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -204,11 +372,11 @@ - + - + @@ -226,33 +394,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..69648ea206 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,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -127,75 +211,159 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -204,11 +372,11 @@ - + - + @@ -226,33 +394,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..c527d74a06 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +518,27 @@ - + - + - + - + - + - + @@ -350,31 +546,31 @@ - + - + - + - + - + - + - + @@ -392,133 +588,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +901,11 @@ - + - + @@ -550,7 +914,7 @@ - + @@ -559,7 +923,7 @@ - + @@ -569,11 +933,11 @@ - + - + @@ -582,227 +946,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -819,27 +1379,27 @@ - + - + - + - + - + - + @@ -847,31 +1407,31 @@ - + - + - + - + - + - + - + @@ -889,133 +1449,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..d35dd96911 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +518,27 @@ - + - + - + - + - + - + @@ -350,31 +546,31 @@ - + - + - + - + - + - + - + @@ -392,133 +588,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +901,11 @@ - + - + @@ -550,7 +914,7 @@ - + @@ -559,7 +923,7 @@ - + @@ -569,11 +933,11 @@ - + - + @@ -582,211 +946,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1333,7 @@ - + @@ -816,227 +1348,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1781,27 @@ - + - + - + - + - + - + @@ -1081,31 +1809,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1851,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..6b48478444 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +518,27 @@ - + - + - + - + - + - + @@ -350,31 +546,31 @@ - + - + - + - + - + - + - + @@ -392,133 +588,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +901,11 @@ - + - + @@ -550,7 +914,7 @@ - + @@ -559,7 +923,7 @@ - + @@ -569,11 +933,11 @@ - + - + @@ -586,207 +950,375 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1333,7 @@ - + @@ -816,227 +1348,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1781,27 @@ - + - + - + - + - + - + @@ -1081,31 +1809,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1851,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..5b50744b8e 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +518,27 @@ - + - + - + - + - + - + @@ -350,31 +546,31 @@ - + - + - + - + - + - + - + @@ -392,133 +588,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +901,11 @@ - + - + @@ -550,7 +914,7 @@ - + @@ -559,7 +923,7 @@ - + @@ -569,11 +933,11 @@ - + - + @@ -582,211 +946,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1333,7 @@ - + @@ -816,227 +1348,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1781,27 @@ - + - + - + - + - + - + @@ -1081,31 +1809,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1851,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..ec4e79d22a 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -322,27 +518,27 @@ - + - + - + - + - + - + @@ -350,31 +546,31 @@ - + - + - + - + - + - + - + @@ -392,133 +588,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -537,11 +901,11 @@ - + - + @@ -550,7 +914,7 @@ - + @@ -559,7 +923,7 @@ - + @@ -569,11 +933,11 @@ - + - + @@ -586,207 +950,375 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -801,7 +1333,7 @@ - + @@ -816,227 +1348,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1053,27 +1781,27 @@ - + - + - + - + - + - + @@ -1081,31 +1809,31 @@ - + - + - + - + - + - + - + @@ -1123,133 +1851,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..1014811f94 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -556,27 +920,27 @@ - + - + - + - + - + - + @@ -584,31 +948,31 @@ - + - + - + - + - + - + - + @@ -626,133 +990,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -772,11 +1304,11 @@ - + - + @@ -785,7 +1317,7 @@ - + @@ -794,7 +1326,7 @@ - + @@ -804,11 +1336,11 @@ - + - + @@ -817,211 +1349,379 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1036,7 +1736,7 @@ - + @@ -1051,227 +1751,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1288,27 +2184,27 @@ - + - + - + - + - + - + @@ -1316,31 +2212,31 @@ - + - + - + - + - + - + - + @@ -1358,133 +2254,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..db25cedbd2 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -556,27 +920,27 @@ - + - + - + - + - + - + @@ -584,31 +948,31 @@ - + - + - + - + - + - + - + @@ -626,133 +990,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -772,11 +1304,11 @@ - + - + @@ -785,7 +1317,7 @@ - + @@ -794,7 +1326,7 @@ - + @@ -804,11 +1336,11 @@ - + - + @@ -821,207 +1353,375 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1036,7 +1736,7 @@ - + @@ -1051,227 +1751,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1288,27 +2184,27 @@ - + - + - + - + - + - + @@ -1316,31 +2212,31 @@ - + - + - + - + - + - + - + @@ -1358,133 +2254,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..91104c0b88 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,423 @@ - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -531,7 +895,7 @@ - + @@ -546,227 +910,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -783,27 +1343,27 @@ - + - + - + - + - + - + @@ -811,31 +1371,31 @@ - + - + - + - + - + - + - + @@ -853,133 +1413,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..9ebd2f147b 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -533,27 +897,27 @@ - + - + - + - + - + - + @@ -561,31 +925,31 @@ - + - + - + - + - + - + - + @@ -603,133 +967,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..919417183e 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -348,27 +544,27 @@ - + - + - + - + - + - + @@ -376,31 +572,31 @@ - + - + - + - + - + - + - + @@ -418,133 +614,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -563,11 +927,11 @@ - + - + @@ -576,151 +940,291 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -733,15 +1237,15 @@ - + - + - + @@ -759,101 +1263,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..aba5cdf553 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..81fcf21f1b 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..ea3ee863e4 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -369,27 +565,27 @@ - + - + - + - + - + - + @@ -397,31 +593,31 @@ - + - + - + - + - + - + - + @@ -439,133 +635,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -584,11 +948,11 @@ - + - + @@ -597,151 +961,291 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -754,15 +1258,15 @@ - + - + - + @@ -780,101 +1284,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..79159f5015 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,399 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -353,27 +549,27 @@ - + - + - + - + - + - + @@ -391,141 +587,309 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -544,19 +908,19 @@ - + - + - + - + @@ -565,7 +929,7 @@ - + @@ -583,101 +947,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..6c3d99f0d6 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,45 +57,45 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + @@ -124,204 +124,400 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -340,27 +536,27 @@ - + - + - + - + - + - + @@ -368,31 +564,31 @@ - + - + - + - + - + - + - + @@ -410,133 +606,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..6c3d99f0d6 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,45 +57,45 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + @@ -124,204 +124,400 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -340,27 +536,27 @@ - + - + - + - + - + - + @@ -368,31 +564,31 @@ - + - + - + - + - + - + - + @@ -410,133 +606,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..6c3d99f0d6 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,45 +57,45 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + @@ -124,204 +124,400 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -340,27 +536,27 @@ - + - + - + - + - + - + @@ -368,31 +564,31 @@ - + - + - + - + - + - + - + @@ -410,133 +606,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..af7fd91535 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -299,27 +495,27 @@ - + - + - + - + - + - + @@ -327,31 +523,31 @@ - + - + - + - + - + - + - + @@ -369,133 +565,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..e0c553b7cb 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,291 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -206,15 +346,15 @@ - + - + - + @@ -232,101 +372,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..9927bd6230 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..1b93709a92 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 @@ -2,10 +2,10 @@ - - - - + + + + @@ -21,16 +21,16 @@ - + - + - - - - + + + + @@ -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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -415,27 +611,27 @@ - + - + - + - + - + - + @@ -443,31 +639,31 @@ - + - + - + - + - + - + - + @@ -485,133 +681,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -630,11 +994,11 @@ - + - + @@ -643,177 +1007,317 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -826,101 +1330,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -943,11 +1559,11 @@ - + - + @@ -956,7 +1572,7 @@ - + @@ -965,7 +1581,7 @@ - + @@ -975,11 +1591,11 @@ - + - + @@ -988,15 +1604,15 @@ - + - + - + @@ -1008,15 +1624,15 @@ - + - + - + @@ -1025,19 +1641,19 @@ - + - + - + - + @@ -1054,15 +1670,15 @@ - + - + - + @@ -1071,227 +1687,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1308,27 +2120,27 @@ - + - + - + - + - + - + @@ -1336,31 +2148,31 @@ - + - + - + - + - + - + - + @@ -1378,133 +2190,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -1523,11 +2503,11 @@ - + - + @@ -1536,151 +2516,291 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1693,15 +2813,15 @@ - + - + - + @@ -1719,101 +2839,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + @@ -1836,11 +3068,11 @@ - + - + @@ -1849,7 +3081,7 @@ - + @@ -1858,7 +3090,7 @@ - + @@ -1868,11 +3100,11 @@ - + - + @@ -1881,227 +3113,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -2118,27 +3546,27 @@ - + - + - + - + - + - + @@ -2146,31 +3574,31 @@ - + - + - + - + - + - + - + @@ -2188,133 +3616,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..f3d68efd51 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -359,27 +555,27 @@ - + - + - + - + - + - + @@ -387,31 +583,31 @@ - + - + - + - + - + - + - + @@ -429,133 +625,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -576,11 +940,11 @@ - + - + @@ -589,7 +953,7 @@ - + @@ -598,7 +962,7 @@ - + @@ -608,11 +972,11 @@ - + - + @@ -621,227 +985,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -858,27 +1418,27 @@ - + - + - + - + - + - + @@ -886,31 +1446,31 @@ - + - + - + - + - + - + - + @@ -928,133 +1488,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..7380884768 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -336,27 +532,27 @@ - + - + - + - + - + - + @@ -364,31 +560,31 @@ - + - + - + - + - + - + - + @@ -406,133 +602,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..7b5ea95fa3 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -298,27 +494,27 @@ - + - + - + - + - + - + @@ -326,31 +522,31 @@ - + - + - + - + - + - + - + @@ -368,133 +564,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -513,7 +877,7 @@ - + @@ -533,7 +897,7 @@ - + @@ -542,151 +906,291 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -699,15 +1203,15 @@ - + - + - + @@ -725,101 +1229,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..ff39aa7c9b 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,399 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -332,27 +528,27 @@ - + - + - + - + - + - + @@ -370,141 +566,309 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -523,19 +887,19 @@ - + - + - + - + @@ -544,143 +908,283 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + @@ -695,7 +1199,7 @@ - + @@ -713,101 +1217,213 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -818,73 +1434,143 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -893,7 +1579,7 @@ - + @@ -911,37 +1597,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..ce6f655f22 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,399 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -332,27 +528,27 @@ - + - + - + - + - + - + @@ -370,141 +566,309 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -526,19 +890,19 @@ - + - + - + - + @@ -547,59 +911,115 @@ - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -614,15 +1034,15 @@ - + - + - + @@ -634,123 +1054,263 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -759,7 +1319,7 @@ - + @@ -777,77 +1337,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..5fc98dd938 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..188f6f7b0d 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,277 @@ - + - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -220,11 +360,11 @@ - + - + @@ -242,77 +382,189 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -331,15 +583,15 @@ - + - + - + @@ -348,91 +600,175 @@ - + - + - + - + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -447,11 +783,11 @@ - + - + @@ -469,41 +805,97 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + @@ -514,83 +906,153 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + @@ -599,15 +1061,15 @@ - + - + - + @@ -625,37 +1087,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..3ad305b7ab 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 @@ -21,10 +21,10 @@ - - - - + + + + @@ -41,10 +41,10 @@ - - - - + + + + @@ -53,227 +53,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -282,227 +478,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -519,27 +911,27 @@ - + - + - + - + - + - + @@ -547,31 +939,31 @@ - + - + - + - + - + - + - + @@ -589,133 +981,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -733,10 +1293,10 @@ - - - - + + + + @@ -753,317 +1313,597 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1075,15 +1915,15 @@ - + - + - + @@ -1101,101 +1941,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..5a9299184c 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -368,27 +564,27 @@ - + - + - + - + - + - + @@ -396,31 +592,31 @@ - + - + - + - + - + - + - + @@ -438,133 +634,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -583,11 +947,11 @@ - + - + @@ -596,7 +960,7 @@ - + @@ -605,7 +969,7 @@ - + @@ -615,11 +979,11 @@ - + - + @@ -628,227 +992,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -865,27 +1425,27 @@ - + - + - + - + - + - + @@ -893,31 +1453,31 @@ - + - + - + - + - + - + - + @@ -935,133 +1495,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -1082,11 +1810,11 @@ - + - + @@ -1095,7 +1823,7 @@ - + @@ -1104,7 +1832,7 @@ - + @@ -1114,11 +1842,11 @@ - + - + @@ -1127,227 +1855,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + - + - + - + - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1364,27 +2288,27 @@ - + - + - + - + - + - + @@ -1392,31 +2316,31 @@ - + - + - + - + - + - + - + @@ -1434,133 +2358,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -1579,11 +2671,11 @@ - + - + @@ -1592,7 +2684,7 @@ - + @@ -1601,7 +2693,7 @@ - + @@ -1611,11 +2703,11 @@ - + - + @@ -1624,227 +2716,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -1861,27 +3149,27 @@ - + - + - + - + - + - + @@ -1889,31 +3177,31 @@ - + - + - + - + - + - + - + @@ -1931,133 +3219,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml new file mode 100644 index 0000000000..81d5db4a69 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml @@ -0,0 +1,2165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..0069ee8ee7 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..6fbc2644c7 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,267 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + @@ -232,7 +372,7 @@ - + @@ -250,85 +390,197 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -347,15 +599,15 @@ - + - + - + @@ -364,7 +616,7 @@ - + @@ -382,117 +634,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..f6a1229769 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..f8ed520f2f 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..ed70382110 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_simple_query_with_date_part__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml new file mode 100644 index 0000000000..49d52f7aae --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml @@ -0,0 +1,863 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml new file mode 100644 index 0000000000..f987f53071 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml @@ -0,0 +1,966 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..d6e800bd30 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..75df770af7 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..ab0edb4ad2 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , 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 , subq_0.paid_at__quarter AS metric_time__quarter , subq_0.paid_at__year AS metric_time__year + , subq_0.paid_at__extract_year AS metric_time__extract_year + , subq_0.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_0.paid_at__extract_month AS metric_time__extract_month + , subq_0.paid_at__extract_week AS metric_time__extract_week + , subq_0.paid_at__extract_day AS metric_time__extract_day + , subq_0.paid_at__extract_dow AS metric_time__extract_dow + , subq_0.paid_at__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -67,32 +116,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..2b917da7a9 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,36 +6,85 @@ 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(isoweek FROM ds) AS ds__extract_week + , EXTRACT(day FROM ds) AS ds__extract_day + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy , 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(isoweek FROM ds) AS booking__ds__extract_week + , EXTRACT(day FROM ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy , paid_at AS metric_time__day , DATE_TRUNC(paid_at, isoweek) AS metric_time__week , DATE_TRUNC(paid_at, month) AS metric_time__month , DATE_TRUNC(paid_at, quarter) AS metric_time__quarter , DATE_TRUNC(paid_at, year) AS metric_time__year + , EXTRACT(year FROM paid_at) AS metric_time__extract_year + , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter + , EXTRACT(month FROM paid_at) AS metric_time__extract_month + , EXTRACT(isoweek FROM paid_at) AS metric_time__extract_week + , EXTRACT(day FROM paid_at) AS metric_time__extract_day + , EXTRACT(dayofweek FROM paid_at) AS metric_time__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , 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.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..58b676e2ff 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -79,32 +128,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..6290ee58d6 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,36 +6,85 @@ 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(isoweek FROM ds) AS ds__extract_week + , EXTRACT(day FROM ds) AS ds__extract_day + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy , 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(isoweek FROM ds) AS booking__ds__extract_week + , EXTRACT(day FROM ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek 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_dow + , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy , ds AS metric_time__day , DATE_TRUNC(ds, isoweek) AS metric_time__week , DATE_TRUNC(ds, month) AS metric_time__month , DATE_TRUNC(ds, quarter) AS metric_time__quarter , DATE_TRUNC(ds, year) AS metric_time__year + , EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(isoweek FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , EXTRACT(dayofyear FROM ds) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host 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..24e3bb6ff9 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , 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 , subq_5.paid_at__quarter AS metric_time__quarter , subq_5.paid_at__year AS metric_time__year + , subq_5.paid_at__extract_year AS metric_time__extract_year + , subq_5.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_5.paid_at__extract_month AS metric_time__extract_month + , subq_5.paid_at__extract_week AS metric_time__extract_week + , subq_5.paid_at__extract_day AS metric_time__extract_day + , subq_5.paid_at__extract_dow AS metric_time__extract_dow + , subq_5.paid_at__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -227,32 +367,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(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , 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(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e9ab8e5153 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , 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 , subq_0.paid_at__quarter AS metric_time__quarter , subq_0.paid_at__year AS metric_time__year + , subq_0.paid_at__extract_year AS metric_time__extract_year + , subq_0.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_0.paid_at__extract_month AS metric_time__extract_month + , subq_0.paid_at__extract_week AS metric_time__extract_week + , subq_0.paid_at__extract_day AS metric_time__extract_day + , subq_0.paid_at__extract_dow AS metric_time__extract_dow + , subq_0.paid_at__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -67,32 +116,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..00e036ec03 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month , DATE_TRUNC('quarter', paid_at) AS metric_time__quarter , DATE_TRUNC('year', paid_at) AS metric_time__year + , EXTRACT(year FROM paid_at) AS metric_time__extract_year + , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter + , EXTRACT(month FROM paid_at) AS metric_time__extract_month + , EXTRACT(week FROM paid_at) AS metric_time__extract_week + , EXTRACT(day FROM paid_at) AS metric_time__extract_day + , EXTRACT(dow FROM paid_at) AS metric_time__extract_dow + , EXTRACT(doy FROM paid_at) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , 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.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..e2cc747ae2 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -79,32 +128,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c6d742fae0 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month , DATE_TRUNC('quarter', ds) AS metric_time__quarter , DATE_TRUNC('year', ds) AS metric_time__year + , EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host 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..c88105f92d 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , 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 , subq_5.paid_at__quarter AS metric_time__quarter , subq_5.paid_at__year AS metric_time__year + , subq_5.paid_at__extract_year AS metric_time__extract_year + , subq_5.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_5.paid_at__extract_month AS metric_time__extract_month + , subq_5.paid_at__extract_week AS metric_time__extract_week + , subq_5.paid_at__extract_day AS metric_time__extract_day + , subq_5.paid_at__extract_dow AS metric_time__extract_dow + , subq_5.paid_at__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -227,32 +367,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e9ab8e5153 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , 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 , subq_0.paid_at__quarter AS metric_time__quarter , subq_0.paid_at__year AS metric_time__year + , subq_0.paid_at__extract_year AS metric_time__extract_year + , subq_0.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_0.paid_at__extract_month AS metric_time__extract_month + , subq_0.paid_at__extract_week AS metric_time__extract_week + , subq_0.paid_at__extract_day AS metric_time__extract_day + , subq_0.paid_at__extract_dow AS metric_time__extract_dow + , subq_0.paid_at__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -67,32 +116,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..00e036ec03 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month , DATE_TRUNC('quarter', paid_at) AS metric_time__quarter , DATE_TRUNC('year', paid_at) AS metric_time__year + , EXTRACT(year FROM paid_at) AS metric_time__extract_year + , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter + , EXTRACT(month FROM paid_at) AS metric_time__extract_month + , EXTRACT(week FROM paid_at) AS metric_time__extract_week + , EXTRACT(day FROM paid_at) AS metric_time__extract_day + , EXTRACT(dow FROM paid_at) AS metric_time__extract_dow + , EXTRACT(doy FROM paid_at) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , 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.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..e2cc747ae2 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -79,32 +128,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c6d742fae0 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month , DATE_TRUNC('quarter', ds) AS metric_time__quarter , DATE_TRUNC('year', ds) AS metric_time__year + , EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host 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..c88105f92d 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , 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 , subq_5.paid_at__quarter AS metric_time__quarter , subq_5.paid_at__year AS metric_time__year + , subq_5.paid_at__extract_year AS metric_time__extract_year + , subq_5.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_5.paid_at__extract_month AS metric_time__extract_month + , subq_5.paid_at__extract_week AS metric_time__extract_week + , subq_5.paid_at__extract_day AS metric_time__extract_day + , subq_5.paid_at__extract_dow AS metric_time__extract_dow + , subq_5.paid_at__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -227,32 +367,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e9ab8e5153 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , 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 , subq_0.paid_at__quarter AS metric_time__quarter , subq_0.paid_at__year AS metric_time__year + , subq_0.paid_at__extract_year AS metric_time__extract_year + , subq_0.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_0.paid_at__extract_month AS metric_time__extract_month + , subq_0.paid_at__extract_week AS metric_time__extract_week + , subq_0.paid_at__extract_day AS metric_time__extract_day + , subq_0.paid_at__extract_dow AS metric_time__extract_dow + , subq_0.paid_at__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -67,32 +116,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..00e036ec03 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month , DATE_TRUNC('quarter', paid_at) AS metric_time__quarter , DATE_TRUNC('year', paid_at) AS metric_time__year + , EXTRACT(year FROM paid_at) AS metric_time__extract_year + , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter + , EXTRACT(month FROM paid_at) AS metric_time__extract_month + , EXTRACT(week FROM paid_at) AS metric_time__extract_week + , EXTRACT(day FROM paid_at) AS metric_time__extract_day + , EXTRACT(dow FROM paid_at) AS metric_time__extract_dow + , EXTRACT(doy FROM paid_at) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , 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.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..e2cc747ae2 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -79,32 +128,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c6d742fae0 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month , DATE_TRUNC('quarter', ds) AS metric_time__quarter , DATE_TRUNC('year', ds) AS metric_time__year + , EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host 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..c88105f92d 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , 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 , subq_5.paid_at__quarter AS metric_time__quarter , subq_5.paid_at__year AS metric_time__year + , subq_5.paid_at__extract_year AS metric_time__extract_year + , subq_5.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_5.paid_at__extract_month AS metric_time__extract_month + , subq_5.paid_at__extract_week AS metric_time__extract_week + , subq_5.paid_at__extract_day AS metric_time__extract_day + , subq_5.paid_at__extract_dow AS metric_time__extract_dow + , subq_5.paid_at__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -227,32 +367,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e9ab8e5153 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , 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 , subq_0.paid_at__quarter AS metric_time__quarter , subq_0.paid_at__year AS metric_time__year + , subq_0.paid_at__extract_year AS metric_time__extract_year + , subq_0.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_0.paid_at__extract_month AS metric_time__extract_month + , subq_0.paid_at__extract_week AS metric_time__extract_week + , subq_0.paid_at__extract_day AS metric_time__extract_day + , subq_0.paid_at__extract_dow AS metric_time__extract_dow + , subq_0.paid_at__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -67,32 +116,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..00e036ec03 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month , DATE_TRUNC('quarter', paid_at) AS metric_time__quarter , DATE_TRUNC('year', paid_at) AS metric_time__year + , EXTRACT(year FROM paid_at) AS metric_time__extract_year + , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter + , EXTRACT(month FROM paid_at) AS metric_time__extract_month + , EXTRACT(week FROM paid_at) AS metric_time__extract_week + , EXTRACT(day FROM paid_at) AS metric_time__extract_day + , EXTRACT(dow FROM paid_at) AS metric_time__extract_dow + , EXTRACT(doy FROM paid_at) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , 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.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..e2cc747ae2 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -79,32 +128,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c6d742fae0 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month , DATE_TRUNC('quarter', ds) AS metric_time__quarter , DATE_TRUNC('year', ds) AS metric_time__year + , EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host 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..c88105f92d 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , 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 , subq_5.paid_at__quarter AS metric_time__quarter , subq_5.paid_at__year AS metric_time__year + , subq_5.paid_at__extract_year AS metric_time__extract_year + , subq_5.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_5.paid_at__extract_month AS metric_time__extract_month + , subq_5.paid_at__extract_week AS metric_time__extract_week + , subq_5.paid_at__extract_day AS metric_time__extract_day + , subq_5.paid_at__extract_dow AS metric_time__extract_dow + , subq_5.paid_at__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -227,32 +367,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..e9ab8e5153 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , 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 , subq_0.paid_at__quarter AS metric_time__quarter , subq_0.paid_at__year AS metric_time__year + , subq_0.paid_at__extract_year AS metric_time__extract_year + , subq_0.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_0.paid_at__extract_month AS metric_time__extract_month + , subq_0.paid_at__extract_week AS metric_time__extract_week + , subq_0.paid_at__extract_day AS metric_time__extract_day + , subq_0.paid_at__extract_dow AS metric_time__extract_dow + , subq_0.paid_at__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -67,32 +116,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..00e036ec03 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , paid_at AS metric_time__day , DATE_TRUNC('week', paid_at) AS metric_time__week , DATE_TRUNC('month', paid_at) AS metric_time__month , DATE_TRUNC('quarter', paid_at) AS metric_time__quarter , DATE_TRUNC('year', paid_at) AS metric_time__year + , EXTRACT(year FROM paid_at) AS metric_time__extract_year + , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter + , EXTRACT(month FROM paid_at) AS metric_time__extract_month + , EXTRACT(week FROM paid_at) AS metric_time__extract_week + , EXTRACT(day FROM paid_at) AS metric_time__extract_day + , EXTRACT(dow FROM paid_at) AS metric_time__extract_dow + , EXTRACT(doy FROM paid_at) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , 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.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..e2cc747ae2 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,36 +5,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -79,32 +128,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..c6d742fae0 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,36 +6,85 @@ 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(dow FROM ds) AS ds__extract_dow + , EXTRACT(doy FROM ds) AS ds__extract_doy , 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(dow FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS ds_partitioned__extract_doy , 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(dow FROM paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS paid_at__extract_doy , 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(dow FROM ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM ds) AS booking__ds__extract_doy , 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(dow FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , 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(dow FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM paid_at) AS booking__paid_at__extract_doy , ds AS metric_time__day , DATE_TRUNC('week', ds) AS metric_time__week , DATE_TRUNC('month', ds) AS metric_time__month , DATE_TRUNC('quarter', ds) AS metric_time__quarter , DATE_TRUNC('year', ds) AS metric_time__year + , EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host 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..c88105f92d 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,36 +27,85 @@ 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_dow + , subq_0.ds__extract_doy , 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_dow + , subq_0.ds_partitioned__extract_doy , 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_dow + , subq_0.paid_at__extract_doy , 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_dow + , subq_0.booking__ds__extract_doy , 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_dow + , subq_0.booking__ds_partitioned__extract_doy , 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_dow + , subq_0.booking__paid_at__extract_doy , subq_0.ds__day AS metric_time__day , subq_0.ds__week AS metric_time__week , subq_0.ds__month AS metric_time__month , subq_0.ds__quarter AS metric_time__quarter , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy , subq_0.listing , subq_0.guest , subq_0.host @@ -101,32 +150,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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,36 +256,85 @@ 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_dow + , subq_5.ds__extract_doy , 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_dow + , subq_5.ds_partitioned__extract_doy , 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_dow + , subq_5.paid_at__extract_doy , 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_dow + , subq_5.booking__ds__extract_doy , 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_dow + , subq_5.booking__ds_partitioned__extract_doy , 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_dow + , subq_5.booking__paid_at__extract_doy , 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 , subq_5.paid_at__quarter AS metric_time__quarter , subq_5.paid_at__year AS metric_time__year + , subq_5.paid_at__extract_year AS metric_time__extract_year + , subq_5.paid_at__extract_quarter AS metric_time__extract_quarter + , subq_5.paid_at__extract_month AS metric_time__extract_month + , subq_5.paid_at__extract_week AS metric_time__extract_week + , subq_5.paid_at__extract_day AS metric_time__extract_day + , subq_5.paid_at__extract_dow AS metric_time__extract_dow + , subq_5.paid_at__extract_doy AS metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -227,32 +367,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(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , 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..84429ca4f1 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,352 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -193,27 +389,27 @@ - + - + - + - + - + - + @@ -221,31 +417,31 @@ - + - + - + - + - + - + - + @@ -263,133 +459,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..f20c045afe 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,400 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -241,27 +437,27 @@ - + - + - + - + - + - + @@ -269,31 +465,31 @@ - + - + - + - + - + - + - + @@ -311,133 +507,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..66d7813741 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,423 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -313,27 +509,27 @@ - + - + - + - + - + - + @@ -341,31 +537,31 @@ - + - + - + - + - + - + - + @@ -383,133 +579,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + @@ -528,11 +892,11 @@ - + - + @@ -541,7 +905,7 @@ - + @@ -550,7 +914,7 @@ - + @@ -560,11 +924,11 @@ - + - + @@ -573,179 +937,375 @@ - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -762,27 +1322,27 @@ - + - + - + - + - + - + @@ -790,31 +1350,31 @@ - + - + - + - + - + - + - + @@ -832,133 +1392,301 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt b/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt index 08f466a809..3abcc19d22 100644 --- a/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt +++ b/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt @@ -1,10 +1,24 @@ ['company__ds__day', + 'company__ds__extract_day', + 'company__ds__extract_dow', + 'company__ds__extract_doy', + 'company__ds__extract_month', + 'company__ds__extract_quarter', + 'company__ds__extract_week', + 'company__ds__extract_year', 'company__ds__month', 'company__ds__quarter', 'company__ds__week', 'company__ds__year', 'company__user', 'ds__day', + 'ds__extract_day', + 'ds__extract_dow', + 'ds__extract_doy', + 'ds__extract_month', + 'ds__extract_quarter', + 'ds__extract_week', + 'ds__extract_year', 'ds__month', 'ds__quarter', 'ds__week', @@ -12,6 +26,13 @@ 'txn_revenue', 'user', 'user__ds__day', + 'user__ds__extract_day', + 'user__ds__extract_dow', + 'user__ds__extract_doy', + 'user__ds__extract_month', + 'user__ds__extract_quarter', + 'user__ds__extract_week', + 'user__ds__extract_year', 'user__ds__month', 'user__ds__quarter', 'user__ds__week', 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/test/sql/test_sql_expr_render.py b/metricflow/test/sql/test_sql_expr_render.py index c123843ae2..5d3e309b36 100644 --- a/metricflow/test/sql/test_sql_expr_render.py +++ b/metricflow/test/sql/test_sql_expr_render.py @@ -17,6 +17,7 @@ SqlComparison, SqlComparisonExpression, SqlDateTruncExpression, + SqlExtractExpression, SqlFunction, SqlIsNullExpression, SqlLogicalExpression, @@ -29,6 +30,7 @@ SqlWindowFunctionExpression, SqlWindowOrderByArgument, ) +from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -193,6 +195,13 @@ def test_date_trunc_expr(default_expr_renderer: DefaultSqlExpressionRenderer) -> assert actual == "DATE_TRUNC('month', ds)" +def test_extract_expr(default_expr_renderer: DefaultSqlExpressionRenderer) -> None: # noqa: D + actual = default_expr_renderer.render_sql_expr( + SqlExtractExpression(date_part=DatePart.DOY, arg=SqlStringExpression("ds")) + ).sql + assert actual == "EXTRACT(doy FROM ds)" + + def test_ratio_computation_expr(default_expr_renderer: DefaultSqlExpressionRenderer) -> None: # noqa: D actual = default_expr_renderer.render_sql_expr( SqlRatioComputationExpression( diff --git a/metricflow/time/date_part.py b/metricflow/time/date_part.py new file mode 100644 index 0000000000..fa0d1ea0a9 --- /dev/null +++ b/metricflow/time/date_part.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from enum import Enum +from typing import List + +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" + DOW = "dow" + DOY = "doy" + + 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.DOW: + return TimeGranularity.DAY.to_int() + elif self is DatePart.DOY: + 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) + + @property + def compatible_granularities(self) -> List[TimeGranularity]: + """Granularities that can be queried with this date part.""" + return [granularity for granularity in TimeGranularity if granularity.to_int() >= self.to_int()] diff --git a/metricflow/time/time_granularity_solver.py b/metricflow/time/time_granularity_solver.py index 8fbf95c601..f23551f612 100644 --- a/metricflow/time/time_granularity_solver.py +++ b/metricflow/time/time_granularity_solver.py @@ -19,6 +19,7 @@ from metricflow.specs.specs import ( TimeDimensionSpec, ) +from metricflow.time.date_part import DatePart from metricflow.time.time_granularity import ( adjust_to_end_of_period, adjust_to_start_of_period, @@ -38,6 +39,7 @@ class PartialTimeDimensionSpec: element_name: str entity_links: Tuple[EntityReference, ...] + date_part: Optional[DatePart] = None @dataclass(frozen=True) @@ -100,37 +102,48 @@ def resolve_granularity_for_partial_time_dimension_specs( Returns a dictionary that maps how the partial time dimension spec should be turned into a time dimension spec. """ + result: Dict[PartialTimeDimensionSpec, TimeDimensionSpec] = {} + for partial_time_dimension_spec in partial_time_dimension_specs: + minimum_time_granularity = self.find_minimum_granularity_for_partial_time_dimension_spec( + partial_time_dimension_spec=partial_time_dimension_spec, metric_references=metric_references + ) + result[partial_time_dimension_spec] = TimeDimensionSpec( + element_name=partial_time_dimension_spec.element_name, + entity_links=partial_time_dimension_spec.entity_links, + time_granularity=minimum_time_granularity, + date_part=partial_time_dimension_spec.date_part, + ) + return result + + def find_minimum_granularity_for_partial_time_dimension_spec( + self, partial_time_dimension_spec: PartialTimeDimensionSpec, metric_references: Sequence[MetricReference] + ) -> TimeGranularity: + """Find minimum granularity allowed for time dimension when queried with given metrics.""" valid_group_by_elements = self._semantic_manifest_lookup.metric_lookup.linkable_set_for_metrics( metric_references=metric_references, ) - result: Dict[PartialTimeDimensionSpec, TimeDimensionSpec] = {} - for partial_time_dimension_spec in partial_time_dimension_specs: - minimum_time_granularity: Optional[TimeGranularity] = None - for path_key in valid_group_by_elements.path_key_to_linkable_dimensions: - if ( - path_key.element_name == partial_time_dimension_spec.element_name - and path_key.entity_links == partial_time_dimension_spec.entity_links - and path_key.time_granularity is not None - ): - minimum_time_granularity = ( - path_key.time_granularity - if minimum_time_granularity is None - else min(minimum_time_granularity, path_key.time_granularity) - ) - - if minimum_time_granularity is not None: - result[partial_time_dimension_spec] = TimeDimensionSpec( - element_name=partial_time_dimension_spec.element_name, - entity_links=partial_time_dimension_spec.entity_links, - time_granularity=minimum_time_granularity, - ) - else: - raise RequestTimeGranularityException( - f"Unable to resolve the time dimension spec for {partial_time_dimension_spec}. " - f"Valid group by elements are:\n" - f"{pformat_big_objects([spec.qualified_name for spec in valid_group_by_elements.as_spec_set.as_tuple])}" + + minimum_time_granularity: Optional[TimeGranularity] = None + for path_key in valid_group_by_elements.path_key_to_linkable_dimensions: + if ( + path_key.element_name == partial_time_dimension_spec.element_name + and path_key.entity_links == partial_time_dimension_spec.entity_links + and path_key.time_granularity is not None + ): + minimum_time_granularity = ( + path_key.time_granularity + if minimum_time_granularity is None + else min(minimum_time_granularity, path_key.time_granularity) ) - return result + + if not minimum_time_granularity: + raise RequestTimeGranularityException( + f"Unable to resolve the time dimension spec for {partial_time_dimension_spec}. " + f"Valid group by elements are:\n" + f"{pformat_big_objects([spec.qualified_name for spec in valid_group_by_elements.as_spec_set.as_tuple])}" + ) + + return minimum_time_granularity def adjust_time_range_to_granularity( self, time_range_constraint: TimeRangeConstraint, time_granularity: TimeGranularity