diff --git a/.changes/unreleased/Features-20231106-150014.yaml b/.changes/unreleased/Features-20231106-150014.yaml new file mode 100644 index 0000000000..37f810fba4 --- /dev/null +++ b/.changes/unreleased/Features-20231106-150014.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Fill nulls for multi-metric queries +time: 2023-11-06T15:00:14.37926-08:00 +custom: + Author: courtneyholcomb + Issue: "850" diff --git a/metricflow/instances.py b/metricflow/instances.py index 1d1aa8eaae..8e85305495 100644 --- a/metricflow/instances.py +++ b/metricflow/instances.py @@ -106,7 +106,7 @@ class EntityInstance(MdoInstance[EntitySpec], SemanticModelElementInstance): # class MetricInstance(MdoInstance[MetricSpec], SerializableDataclass): # noqa: D associated_columns: Tuple[ColumnAssociation, ...] spec: MetricSpec - defined_from: Tuple[MetricModelReference, ...] + defined_from: MetricModelReference @dataclass(frozen=True) diff --git a/metricflow/model/semantics/metric_lookup.py b/metricflow/model/semantics/metric_lookup.py index 92d589f62a..f43348821d 100644 --- a/metricflow/model/semantics/metric_lookup.py +++ b/metricflow/model/semantics/metric_lookup.py @@ -1,12 +1,13 @@ from __future__ import annotations import logging -from typing import Dict, FrozenSet, List, Sequence +from typing import Dict, FrozenSet, List, Optional, Sequence +from dbt_semantic_interfaces.enum_extension import assert_values_exhausted from dbt_semantic_interfaces.implementations.filters.where_filter import PydanticWhereFilterIntersection from dbt_semantic_interfaces.implementations.metric import PydanticMetricTimeWindow from dbt_semantic_interfaces.protocols import WhereFilter -from dbt_semantic_interfaces.protocols.metric import Metric, MetricType +from dbt_semantic_interfaces.protocols.metric import Metric, MetricInputMeasure, MetricType from dbt_semantic_interfaces.protocols.semantic_manifest import SemanticManifest from dbt_semantic_interfaces.references import MetricReference @@ -105,6 +106,23 @@ def add_metric(self, metric: Metric) -> None: ) self._metrics[metric_reference] = metric + def configured_input_measure_for_metric(self, metric_reference: MetricReference) -> Optional[MetricInputMeasure]: + """Get input measure defined in the original metric config, if exists. + + When SemanticModel is constructed, input measures from input metrics are added to the list of input measures + for a metric. Here, use rules about metric types to determine which input measures were defined in the config: + - Simple & cumulative metrics require one input measure, and can't take any input metrics. + - Derived & ratio metrics take no input measures, only input metrics. + """ + metric = self.get_metric(metric_reference=metric_reference) + if metric.type is MetricType.CUMULATIVE or metric.type is MetricType.SIMPLE: + assert len(metric.input_measures) == 1, "Simple and cumulative metrics should have one input measure." + return metric.input_measures[0] + elif metric.type is MetricType.RATIO or metric.type is MetricType.DERIVED: + return None + else: + assert_values_exhausted(metric.type) + def measures_for_metric( self, metric_reference: MetricReference, diff --git a/metricflow/plan_conversion/dataflow_to_sql.py b/metricflow/plan_conversion/dataflow_to_sql.py index e403f3648e..87f1471dbf 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -2,11 +2,11 @@ import logging from collections import OrderedDict -from typing import List, Optional, Sequence, Union +from typing import List, Optional, Sequence, Tuple, Union from dbt_semantic_interfaces.enum_extension import assert_values_exhausted from dbt_semantic_interfaces.protocols.metric import MetricInputMeasure, MetricType -from dbt_semantic_interfaces.references import MetricModelReference +from dbt_semantic_interfaces.references import MetricModelReference, MetricReference from dbt_semantic_interfaces.type_enums.aggregation_type import AggregationType from metricflow.aggregation_properties import AggregationState @@ -706,7 +706,7 @@ def visit_compute_metrics_node(self, node: ComputeMetricsNode) -> SqlDataSet: metric_instances.append( MetricInstance( associated_columns=(output_column_association,), - defined_from=(MetricModelReference(metric_name=metric_spec.element_name),), + defined_from=MetricModelReference(metric_name=metric_spec.element_name), spec=metric_spec.alias_spec, ) ) @@ -862,24 +862,25 @@ def visit_where_constraint_node(self, node: WhereConstraintNode) -> SqlDataSet: ), ) - def _make_select_columns_for_metrics( + def _make_select_columns_for_multiple_metrics( self, - table_alias_to_metric_specs: OrderedDict[str, Sequence[MetricSpec]], + table_alias_to_metric_instances: OrderedDict[str, Tuple[MetricInstance, ...]], aggregation_type: Optional[AggregationType], ) -> List[SqlSelectColumn]: """Creates select columns that get the given metric using the given table alias. e.g. - with table_alias_to_metric_specs = {"a": MetricSpec(element_name="bookings")} + with table_alias_to_metric_instances = {"a": MetricSpec(element_name="bookings")} -> a.bookings AS bookings """ select_columns = [] - for table_alias, metric_specs in table_alias_to_metric_specs.items(): - for metric_spec in metric_specs: + for table_alias, metric_instances in table_alias_to_metric_instances.items(): + for metric_instance in metric_instances: + metric_spec = metric_instance.spec metric_column_name = self._column_association_resolver.resolve_spec(metric_spec).column_name column_reference_expression = SqlColumnReferenceExpression( col_ref=SqlColumnReference( @@ -894,6 +895,21 @@ def _make_select_columns_for_metrics( else: select_expression = column_reference_expression + # At this point, the MetricSpec might have the alias in place of the element name, so we need to look + # back at where it was defined from to get the metric element name. + metric_reference = MetricReference(element_name=metric_instance.defined_from.metric_name) + input_measure = self._metric_lookup.configured_input_measure_for_metric( + metric_reference=metric_reference + ) + if input_measure and input_measure.fill_nulls_with is not None: + select_expression = SqlAggregateFunctionExpression( + sql_function=SqlFunction.COALESCE, + sql_function_args=[ + select_expression, + SqlStringExpression(str(input_measure.fill_nulls_with)), + ], + ) + select_columns.append( SqlSelectColumn( expr=select_expression, @@ -938,13 +954,13 @@ def visit_combine_metrics_node(self, node: CombineMetricsNode) -> SqlDataSet: ), "Shouldn't have a CombineMetricsNode in the dataflow plan if there's only 1 parent." parent_data_sets: List[AnnotatedSqlDataSet] = [] - table_alias_to_metric_specs: OrderedDict[str, Sequence[MetricSpec]] = OrderedDict() + table_alias_to_metric_instances: OrderedDict[str, Tuple[MetricInstance, ...]] = OrderedDict() for parent_node in node.parent_nodes: parent_sql_data_set = parent_node.accept(self) table_alias = self._next_unique_table_alias() parent_data_sets.append(AnnotatedSqlDataSet(data_set=parent_sql_data_set, alias=table_alias)) - table_alias_to_metric_specs[table_alias] = parent_sql_data_set.instance_set.spec_set.metric_specs + table_alias_to_metric_instances[table_alias] = parent_sql_data_set.instance_set.metric_instances # When we create the components of the join that combines metrics it will be one of INNER, FULL OUTER, # or CROSS JOIN. Order doesn't matter for these join types, so we will use the first element in the FROM @@ -986,8 +1002,9 @@ def visit_combine_metrics_node(self, node: CombineMetricsNode) -> SqlDataSet: metric_aggregation_type = AggregationType.MAX metric_select_column_set = SelectColumnSet( - metric_columns=self._make_select_columns_for_metrics( - table_alias_to_metric_specs, aggregation_type=metric_aggregation_type + metric_columns=self._make_select_columns_for_multiple_metrics( + table_alias_to_metric_instances=table_alias_to_metric_instances, + aggregation_type=metric_aggregation_type, ) ) linkable_select_column_set = linkable_spec_set.transform( diff --git a/metricflow/specs/specs.py b/metricflow/specs/specs.py index 2b2e8b9544..7f17fabbfb 100644 --- a/metricflow/specs/specs.py +++ b/metricflow/specs/specs.py @@ -436,7 +436,7 @@ def from_reference(reference: MetricReference) -> MetricSpec: @property def alias_spec(self) -> MetricSpec: - """Returns a MetricSpec represneting the alias state.""" + """Returns a MetricSpec representing the alias state.""" return MetricSpec( element_name=self.alias or self.element_name, constraint=self.constraint, diff --git a/metricflow/test/fixtures/source_table_snapshots/simple_model/fct_views.yaml b/metricflow/test/fixtures/source_table_snapshots/simple_model/fct_views.yaml index 694e980c20..00ddd1b55f 100644 --- a/metricflow/test/fixtures/source_table_snapshots/simple_model/fct_views.yaml +++ b/metricflow/test/fixtures/source_table_snapshots/simple_model/fct_views.yaml @@ -18,3 +18,5 @@ table_snapshot: - ["2020-01-02", "2020-01-02", "u1612112", "l2718281"] - ["2020-01-02", "2020-01-02", "u0004114", ""] - ["2020-01-02", "2020-01-02", "u0004114", "l7891283-incomplete"] + - ["2020-01-04", "2020-01-02", "u1612112", "l2718281"] + - ["2020-01-05", "2020-01-02", "u0004114", ""] diff --git a/metricflow/test/integration/query_output/__init__.py b/metricflow/test/integration/query_output/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/metricflow/test/integration/query_output/test_fill_nulls_with_0.py b/metricflow/test/integration/query_output/test_fill_nulls_with_0.py new file mode 100644 index 0000000000..8c2b58a926 --- /dev/null +++ b/metricflow/test/integration/query_output/test_fill_nulls_with_0.py @@ -0,0 +1,145 @@ +from __future__ import annotations + +import datetime + +import pytest +from _pytest.fixtures import FixtureRequest + +from metricflow.engine.metricflow_engine import MetricFlowQueryRequest +from metricflow.protocols.sql_client import SqlClient +from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState +from metricflow.test.integration.conftest import IntegrationTestHelpers +from metricflow.test.snapshot_utils import assert_object_snapshot_equal + + +@pytest.mark.sql_engine_snapshot +def test_simple_fill_nulls_with_0_metric_time( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + sql_client: SqlClient, + it_helpers: IntegrationTestHelpers, +) -> None: + query_result = it_helpers.mf_engine.query( + MetricFlowQueryRequest.create_with_random_request_id( + metric_names=["bookings_fill_nulls_with_0"], + group_by_names=["metric_time"], + order_by_names=["metric_time"], + time_constraint_start=datetime.datetime(2019, 11, 27), + time_constraint_end=datetime.datetime(2020, 1, 5), + ) + ) + assert query_result.result_df is not None, "Unexpected empty result." + + assert_object_snapshot_equal( + request=request, + mf_test_session_state=mf_test_session_state, + obj_id="query_output", + obj=query_result.result_df.to_string(), + sql_client=sql_client, + ) + + +@pytest.mark.sql_engine_snapshot +def test_simple_fill_nulls_with_0_month( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + sql_client: SqlClient, + it_helpers: IntegrationTestHelpers, +) -> None: + query_result = it_helpers.mf_engine.query( + MetricFlowQueryRequest.create_with_random_request_id( + metric_names=["bookings_fill_nulls_with_0"], + group_by_names=["metric_time__month"], + order_by_names=["metric_time__month"], + time_constraint_start=datetime.datetime(2019, 1, 1), + time_constraint_end=datetime.datetime(2020, 12, 1), + ) + ) + assert query_result.result_df is not None, "Unexpected empty result." + + assert_object_snapshot_equal( + request=request, + mf_test_session_state=mf_test_session_state, + obj_id="query_output", + obj=query_result.result_df.to_string(), + sql_client=sql_client, + ) + + +@pytest.mark.sql_engine_snapshot +def test_simple_join_to_time_spine( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + sql_client: SqlClient, + it_helpers: IntegrationTestHelpers, +) -> None: + query_result = it_helpers.mf_engine.query( + MetricFlowQueryRequest.create_with_random_request_id( + metric_names=["bookings_join_to_time_spine"], + group_by_names=["metric_time"], + time_constraint_start=datetime.datetime(2019, 11, 27), + time_constraint_end=datetime.datetime(2020, 1, 5), + order_by_names=["metric_time"], + ) + ) + assert query_result.result_df is not None, "Unexpected empty result." + + assert_object_snapshot_equal( + request=request, + mf_test_session_state=mf_test_session_state, + obj_id="query_output", + obj=query_result.result_df.to_string(), + sql_client=sql_client, + ) + + +@pytest.mark.sql_engine_snapshot +def test_fill_nulls_with_0_multi_metric_query( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + sql_client: SqlClient, + it_helpers: IntegrationTestHelpers, +) -> None: + query_result = it_helpers.mf_engine.query( + MetricFlowQueryRequest.create_with_random_request_id( + metric_names=["bookings_fill_nulls_with_0", "views"], + group_by_names=["metric_time"], + order_by_names=["metric_time"], + time_constraint_start=datetime.datetime(2019, 11, 27), + time_constraint_end=datetime.datetime(2020, 1, 5), + ) + ) + assert query_result.result_df is not None, "Unexpected empty result." + + assert_object_snapshot_equal( + request=request, + mf_test_session_state=mf_test_session_state, + obj_id="query_output", + obj=query_result.result_df.to_string(), + sql_client=sql_client, + ) + + +@pytest.mark.sql_engine_snapshot +def test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + sql_client: SqlClient, + it_helpers: IntegrationTestHelpers, +) -> None: + query_result = it_helpers.mf_engine.query( + MetricFlowQueryRequest.create_with_random_request_id( + metric_names=["bookings_fill_nulls_with_0_without_time_spine", "views"], + group_by_names=["metric_time", "listing__is_lux_latest"], + order_by_names=["metric_time", "listing__is_lux_latest"], + ) + ) + assert query_result.result_df is not None, "Unexpected empty result." + + assert_object_snapshot_equal( + request=request, + mf_test_session_state=mf_test_session_state, + obj_id="query_output", + obj=query_result.result_df.to_string(), + sql_client=sql_client, + ) diff --git a/metricflow/test/integration/test_cases/itest_metrics.yaml b/metricflow/test/integration/test_cases/itest_metrics.yaml index 425bae5fb1..c0893e5c73 100644 --- a/metricflow/test/integration/test_cases/itest_metrics.yaml +++ b/metricflow/test/integration/test_cases/itest_metrics.yaml @@ -34,7 +34,7 @@ integration_test: check_query: | SELECT booking_value * views AS views_times_booking_value - , b.ds AS metric_time__day + , COALESCE(b.ds, v.ds) AS metric_time__day FROM ( SELECT SUM(booking_value) AS booking_value @@ -101,7 +101,7 @@ integration_test: metrics: ["instant_booking_value", "views"] group_bys: ["metric_time"] check_query: | - SELECT instant_booking_value, views, a.ds AS metric_time__day + SELECT instant_booking_value, views, COALESCE(a.ds, b.ds) AS metric_time__day FROM ( SELECT SUM(booking_value) AS instant_booking_value @@ -275,7 +275,7 @@ integration_test: check_query: | SELECT CAST(bookings AS {{ double_data_type_name }}) / NULLIF(views, 0) AS bookings_per_view - , groupby_8cbdaa28.ds AS metric_time__day + , COALESCE(groupby_8cbdaa28.ds, groupby_68058b0b.ds) AS metric_time__day FROM ( SELECT COUNT(*) AS bookings @@ -1280,7 +1280,7 @@ integration_test: FROM ( SELECT subq_7.metric_time__day - , subq_7.bookings_fill_nulls_with_0 AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , subq_15.bookings_2_weeks_ago AS bookings_2_weeks_ago FROM ( SELECT @@ -1312,4 +1312,159 @@ integration_test: GROUP BY subq_11.ds ) subq_15 ON subq_7.metric_time__day = subq_15.metric_time__day + GROUP BY 1, 3 ) subq_16 +--- +integration_test: + name: fill_nulls_with_0_multi_metric_query + description: Test a multi-metric query that fills nulls + model: SIMPLE_MODEL + metrics: ["bookings_fill_nulls_with_0", "views"] + group_by_objs: [{"name": "metric_time"}] + check_query: | + SELECT + COALESCE(subq_7.metric_time__day, subq_12.metric_time__day) AS metric_time__day + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 + , MAX(subq_12.views) AS views + FROM ( + SELECT + subq_5.ds AS metric_time__day + , COALESCE(subq_3.bookings, 0) AS bookings_fill_nulls_with_0 + FROM {{ source_schema }}.mf_time_spine subq_5 + LEFT OUTER JOIN ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day + , SUM(1) AS bookings + FROM {{ source_schema }}.fct_bookings bookings_source_src_1 + GROUP BY metric_time__day + ) subq_3 + ON subq_5.ds = subq_3.metric_time__day + ) subq_7 + FULL OUTER JOIN ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day + , SUM(1) AS views + FROM {{ source_schema }}.fct_views views_source_src_9 + GROUP BY metric_time__day + ) subq_12 + ON subq_7.metric_time__day = subq_12.metric_time__day + GROUP BY COALESCE(subq_7.metric_time__day, subq_12.metric_time__day) +--- +integration_test: + name: fill_nulls_with_0_multi_metric_query_with_nesting + description: Test a multi-metric query with a nested join that fills nulls + model: SIMPLE_MODEL + metrics: ["bookings_growth_2_weeks_fill_nulls_with_0_for_non_offset", "booking_value"] + group_by_objs: [{"name": "metric_time"}] + check_query: | + SELECT + COALESCE(subq_17.metric_time__day, subq_22.metric_time__day) AS metric_time__day + , MAX(subq_17.bookings_growth_2_weeks_fill_nulls_with_0_for_non_offset) AS bookings_growth_2_weeks_fill_nulls_with_0_for_non_offset + , MAX(subq_22.booking_value) AS booking_value + FROM ( + SELECT + metric_time__day + , bookings_fill_nulls_with_0 - bookings_2_weeks_ago AS bookings_growth_2_weeks_fill_nulls_with_0_for_non_offset + FROM ( + SELECT + COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 + , MAX(subq_15.bookings_2_weeks_ago) AS bookings_2_weeks_ago + FROM ( + SELECT + metric_time__day + , COALESCE(bookings, 0) AS bookings_fill_nulls_with_0 + FROM ( + SELECT + subq_5.ds AS metric_time__day + , subq_3.bookings AS bookings + FROM {{ source_schema }}.mf_time_spine subq_5 + LEFT OUTER JOIN ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day + , SUM(1) AS bookings + FROM {{ source_schema }}.fct_bookings bookings_source_src_1 + GROUP BY metric_time__day + ) subq_3 + ON subq_5.ds = subq_3.metric_time__day + ) subq_6 + ) subq_7 + FULL OUTER JOIN ( + SELECT + subq_11.ds AS metric_time__day + , SUM(subq_9.bookings) AS bookings_2_weeks_ago + FROM {{ source_schema }}.mf_time_spine subq_11 + INNER JOIN ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day + , 1 AS bookings + FROM {{ source_schema }}.fct_bookings bookings_source_src_1 + ) subq_9 + ON {{ render_date_sub("subq_11", "ds", 14, TimeGranularity.DAY) }} = subq_9.metric_time__day + GROUP BY subq_11.ds + ) subq_15 + ON subq_7.metric_time__day = subq_15.metric_time__day + GROUP BY COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) + ) subq_16 + ) subq_17 + FULL OUTER JOIN ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day + , SUM(booking_value) AS booking_value + FROM {{ source_schema }}.fct_bookings bookings_source_src_1 + GROUP BY {{ render_date_trunc("ds", TimeGranularity.DAY) }} + ) subq_22 + ON subq_17.metric_time__day = subq_22.metric_time__day + GROUP BY COALESCE(subq_17.metric_time__day, subq_22.metric_time__day) +--- +integration_test: + name: fill_nulls_with_0_multi_metric_query_with_categorical_dimension + description: Test a multi-metric query that fills nulls + model: SIMPLE_MODEL + metrics: ["bookings_fill_nulls_with_0_without_time_spine", "views"] + group_by_objs: [{"name": "metric_time"}, {"name": "listing__is_lux_latest"}] + check_query: | + SELECT + COALESCE(subq_9.metric_time__day, subq_19.metric_time__day) AS metric_time__day + , COALESCE(subq_9.listing__is_lux_latest, subq_19.listing__is_lux_latest) AS listing__is_lux_latest + , COALESCE(MAX(subq_9.bookings_fill_nulls_with_0_without_time_spine), 0) AS bookings_fill_nulls_with_0_without_time_spine + , MAX(subq_19.views) AS views + FROM ( + SELECT + subq_2.metric_time__day AS metric_time__day + , listings_latest_src_4.is_lux AS listing__is_lux_latest + , COALESCE(SUM(subq_2.bookings), 0) AS bookings_fill_nulls_with_0_without_time_spine + FROM ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day + , listing_id AS listing + , 1 AS bookings + FROM {{ source_schema }}.fct_bookings bookings_source_src_1 + ) subq_2 + LEFT OUTER JOIN + {{ source_schema }}.dim_listings_latest listings_latest_src_4 + ON subq_2.listing = listings_latest_src_4.listing_id + GROUP BY subq_2.metric_time__day, listings_latest_src_4.is_lux + ) subq_9 + FULL OUTER JOIN ( + SELECT + subq_12.metric_time__day AS metric_time__day + , listings_latest_src_4.is_lux AS listing__is_lux_latest + , SUM(subq_12.views) AS views + FROM ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day + , listing_id AS listing + , 1 AS views + FROM {{ source_schema }}.fct_views views_source_src_9 + ) subq_12 + LEFT OUTER JOIN + {{ source_schema }}.dim_listings_latest listings_latest_src_4 + ON subq_12.listing = listings_latest_src_4.listing_id + GROUP BY subq_12.metric_time__day, listings_latest_src_4.is_lux + ) subq_19 + ON (subq_9.listing__is_lux_latest = subq_19.listing__is_lux_latest) + AND (subq_9.metric_time__day = subq_19.metric_time__day) + GROUP BY + COALESCE(subq_9.metric_time__day, subq_19.metric_time__day) + , COALESCE(subq_9.listing__is_lux_latest, subq_19.listing__is_lux_latest) diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_fill_nulls_with_0_multi_metric_query__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_fill_nulls_with_0_multi_metric_query__query_output.txt new file mode 100644 index 0000000000..15d152a963 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_fill_nulls_with_0_multi_metric_query__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 views +0 2019-11-27 0 NaN +1 2019-11-28 0 NaN +2 2019-11-29 0 NaN +3 2019-11-30 0 NaN +4 2019-12-01 1 NaN +5 2019-12-02 0 NaN +6 2019-12-03 0 NaN +7 2019-12-04 0 NaN +8 2019-12-05 0 NaN +9 2019-12-06 0 NaN +10 2019-12-07 0 NaN +11 2019-12-08 0 NaN +12 2019-12-09 0 NaN +13 2019-12-10 0 NaN +14 2019-12-11 0 NaN +15 2019-12-12 0 NaN +16 2019-12-13 0 NaN +17 2019-12-14 0 NaN +18 2019-12-15 0 NaN +19 2019-12-16 0 NaN +20 2019-12-17 0 NaN +21 2019-12-18 10 NaN +22 2019-12-19 18 NaN +23 2019-12-20 2 NaN +24 2019-12-21 0 NaN +25 2019-12-22 0 NaN +26 2019-12-23 0 NaN +27 2019-12-24 0 NaN +28 2019-12-25 0 NaN +29 2019-12-26 0 NaN +30 2019-12-27 0 NaN +31 2019-12-28 0 NaN +32 2019-12-29 0 NaN +33 2019-12-30 0 NaN +34 2019-12-31 0 NaN +35 2020-01-01 5 2.0 +36 2020-01-02 9 5.0 +37 2020-01-03 1 NaN +38 2020-01-04 0 1.0 +39 2020-01-05 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt new file mode 100644 index 0000000000..985b33cc21 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt @@ -0,0 +1,16 @@ + metric_time__day listing__is_lux_latest bookings_fill_nulls_with_0_without_time_spine views +0 2019-12-01 True 1 NaN +1 2019-12-18 False 4 NaN +2 2019-12-18 True 6 NaN +3 2019-12-19 None 6 NaN +4 2019-12-19 False 6 NaN +5 2019-12-19 True 6 NaN +6 2019-12-20 True 2 NaN +7 2020-01-01 False 2 NaN +8 2020-01-01 True 3 2.0 +9 2020-01-02 None 3 1.0 +10 2020-01-02 False 3 3.0 +11 2020-01-02 True 3 1.0 +12 2020-01-03 True 1 NaN +13 2020-01-04 False 0 1.0 +14 2020-01-05 None 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_fill_nulls_with_0_metric_time__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_fill_nulls_with_0_metric_time__query_output.txt new file mode 100644 index 0000000000..7a4726bf18 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_fill_nulls_with_0_metric_time__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 +0 2019-11-27 0 +1 2019-11-28 0 +2 2019-11-29 0 +3 2019-11-30 0 +4 2019-12-01 1 +5 2019-12-02 0 +6 2019-12-03 0 +7 2019-12-04 0 +8 2019-12-05 0 +9 2019-12-06 0 +10 2019-12-07 0 +11 2019-12-08 0 +12 2019-12-09 0 +13 2019-12-10 0 +14 2019-12-11 0 +15 2019-12-12 0 +16 2019-12-13 0 +17 2019-12-14 0 +18 2019-12-15 0 +19 2019-12-16 0 +20 2019-12-17 0 +21 2019-12-18 10 +22 2019-12-19 18 +23 2019-12-20 2 +24 2019-12-21 0 +25 2019-12-22 0 +26 2019-12-23 0 +27 2019-12-24 0 +28 2019-12-25 0 +29 2019-12-26 0 +30 2019-12-27 0 +31 2019-12-28 0 +32 2019-12-29 0 +33 2019-12-30 0 +34 2019-12-31 0 +35 2020-01-01 5 +36 2020-01-02 9 +37 2020-01-03 1 +38 2020-01-04 0 +39 2020-01-05 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_fill_nulls_with_0_month__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_fill_nulls_with_0_month__query_output.txt new file mode 100644 index 0000000000..7ddd9fa0ea --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_fill_nulls_with_0_month__query_output.txt @@ -0,0 +1,25 @@ + metric_time__month bookings_fill_nulls_with_0 +0 2019-01-01 0 +1 2019-02-01 0 +2 2019-03-01 0 +3 2019-04-01 0 +4 2019-05-01 0 +5 2019-06-01 0 +6 2019-07-01 0 +7 2019-08-01 0 +8 2019-09-01 0 +9 2019-10-01 0 +10 2019-11-01 0 +11 2019-12-01 31 +12 2020-01-01 15 +13 2020-02-01 0 +14 2020-03-01 0 +15 2020-04-01 0 +16 2020-05-01 0 +17 2020-06-01 0 +18 2020-07-01 0 +19 2020-08-01 0 +20 2020-09-01 0 +21 2020-10-01 0 +22 2020-11-01 0 +23 2020-12-01 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_join_to_time_spine__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_join_to_time_spine__query_output.txt new file mode 100644 index 0000000000..2a91746dc1 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/BigQuery/test_simple_join_to_time_spine__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_join_to_time_spine +0 2019-11-27 NaN +1 2019-11-28 NaN +2 2019-11-29 NaN +3 2019-11-30 NaN +4 2019-12-01 1.0 +5 2019-12-02 NaN +6 2019-12-03 NaN +7 2019-12-04 NaN +8 2019-12-05 NaN +9 2019-12-06 NaN +10 2019-12-07 NaN +11 2019-12-08 NaN +12 2019-12-09 NaN +13 2019-12-10 NaN +14 2019-12-11 NaN +15 2019-12-12 NaN +16 2019-12-13 NaN +17 2019-12-14 NaN +18 2019-12-15 NaN +19 2019-12-16 NaN +20 2019-12-17 NaN +21 2019-12-18 10.0 +22 2019-12-19 18.0 +23 2019-12-20 2.0 +24 2019-12-21 NaN +25 2019-12-22 NaN +26 2019-12-23 NaN +27 2019-12-24 NaN +28 2019-12-25 NaN +29 2019-12-26 NaN +30 2019-12-27 NaN +31 2019-12-28 NaN +32 2019-12-29 NaN +33 2019-12-30 NaN +34 2019-12-31 NaN +35 2020-01-01 5.0 +36 2020-01-02 9.0 +37 2020-01-03 1.0 +38 2020-01-04 NaN +39 2020-01-05 NaN diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_fill_nulls_with_0_multi_metric_query__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_fill_nulls_with_0_multi_metric_query__query_output.txt new file mode 100644 index 0000000000..855967c2d5 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_fill_nulls_with_0_multi_metric_query__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 views +0 2019-11-27 00:00:00+00:00 0 NaN +1 2019-11-28 00:00:00+00:00 0 NaN +2 2019-11-29 00:00:00+00:00 0 NaN +3 2019-11-30 00:00:00+00:00 0 NaN +4 2019-12-01 00:00:00+00:00 1 NaN +5 2019-12-02 00:00:00+00:00 0 NaN +6 2019-12-03 00:00:00+00:00 0 NaN +7 2019-12-04 00:00:00+00:00 0 NaN +8 2019-12-05 00:00:00+00:00 0 NaN +9 2019-12-06 00:00:00+00:00 0 NaN +10 2019-12-07 00:00:00+00:00 0 NaN +11 2019-12-08 00:00:00+00:00 0 NaN +12 2019-12-09 00:00:00+00:00 0 NaN +13 2019-12-10 00:00:00+00:00 0 NaN +14 2019-12-11 00:00:00+00:00 0 NaN +15 2019-12-12 00:00:00+00:00 0 NaN +16 2019-12-13 00:00:00+00:00 0 NaN +17 2019-12-14 00:00:00+00:00 0 NaN +18 2019-12-15 00:00:00+00:00 0 NaN +19 2019-12-16 00:00:00+00:00 0 NaN +20 2019-12-17 00:00:00+00:00 0 NaN +21 2019-12-18 00:00:00+00:00 10 NaN +22 2019-12-19 00:00:00+00:00 18 NaN +23 2019-12-20 00:00:00+00:00 2 NaN +24 2019-12-21 00:00:00+00:00 0 NaN +25 2019-12-22 00:00:00+00:00 0 NaN +26 2019-12-23 00:00:00+00:00 0 NaN +27 2019-12-24 00:00:00+00:00 0 NaN +28 2019-12-25 00:00:00+00:00 0 NaN +29 2019-12-26 00:00:00+00:00 0 NaN +30 2019-12-27 00:00:00+00:00 0 NaN +31 2019-12-28 00:00:00+00:00 0 NaN +32 2019-12-29 00:00:00+00:00 0 NaN +33 2019-12-30 00:00:00+00:00 0 NaN +34 2019-12-31 00:00:00+00:00 0 NaN +35 2020-01-01 00:00:00+00:00 5 2.0 +36 2020-01-02 00:00:00+00:00 9 5.0 +37 2020-01-03 00:00:00+00:00 1 NaN +38 2020-01-04 00:00:00+00:00 0 1.0 +39 2020-01-05 00:00:00+00:00 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt new file mode 100644 index 0000000000..f352a88aca --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt @@ -0,0 +1,16 @@ + metric_time__day listing__is_lux_latest bookings_fill_nulls_with_0_without_time_spine views +0 2019-12-01 00:00:00+00:00 True 1 NaN +1 2019-12-18 00:00:00+00:00 False 4 NaN +2 2019-12-18 00:00:00+00:00 True 6 NaN +3 2019-12-19 00:00:00+00:00 None 6 NaN +4 2019-12-19 00:00:00+00:00 False 6 NaN +5 2019-12-19 00:00:00+00:00 True 6 NaN +6 2019-12-20 00:00:00+00:00 True 2 NaN +7 2020-01-01 00:00:00+00:00 False 2 NaN +8 2020-01-01 00:00:00+00:00 True 3 2.0 +9 2020-01-02 00:00:00+00:00 None 3 1.0 +10 2020-01-02 00:00:00+00:00 False 3 3.0 +11 2020-01-02 00:00:00+00:00 True 3 1.0 +12 2020-01-03 00:00:00+00:00 True 1 NaN +13 2020-01-04 00:00:00+00:00 False 0 1.0 +14 2020-01-05 00:00:00+00:00 None 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_fill_nulls_with_0_metric_time__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_fill_nulls_with_0_metric_time__query_output.txt new file mode 100644 index 0000000000..9cb9d895c7 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_fill_nulls_with_0_metric_time__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 +0 2019-11-27 00:00:00+00:00 0 +1 2019-11-28 00:00:00+00:00 0 +2 2019-11-29 00:00:00+00:00 0 +3 2019-11-30 00:00:00+00:00 0 +4 2019-12-01 00:00:00+00:00 1 +5 2019-12-02 00:00:00+00:00 0 +6 2019-12-03 00:00:00+00:00 0 +7 2019-12-04 00:00:00+00:00 0 +8 2019-12-05 00:00:00+00:00 0 +9 2019-12-06 00:00:00+00:00 0 +10 2019-12-07 00:00:00+00:00 0 +11 2019-12-08 00:00:00+00:00 0 +12 2019-12-09 00:00:00+00:00 0 +13 2019-12-10 00:00:00+00:00 0 +14 2019-12-11 00:00:00+00:00 0 +15 2019-12-12 00:00:00+00:00 0 +16 2019-12-13 00:00:00+00:00 0 +17 2019-12-14 00:00:00+00:00 0 +18 2019-12-15 00:00:00+00:00 0 +19 2019-12-16 00:00:00+00:00 0 +20 2019-12-17 00:00:00+00:00 0 +21 2019-12-18 00:00:00+00:00 10 +22 2019-12-19 00:00:00+00:00 18 +23 2019-12-20 00:00:00+00:00 2 +24 2019-12-21 00:00:00+00:00 0 +25 2019-12-22 00:00:00+00:00 0 +26 2019-12-23 00:00:00+00:00 0 +27 2019-12-24 00:00:00+00:00 0 +28 2019-12-25 00:00:00+00:00 0 +29 2019-12-26 00:00:00+00:00 0 +30 2019-12-27 00:00:00+00:00 0 +31 2019-12-28 00:00:00+00:00 0 +32 2019-12-29 00:00:00+00:00 0 +33 2019-12-30 00:00:00+00:00 0 +34 2019-12-31 00:00:00+00:00 0 +35 2020-01-01 00:00:00+00:00 5 +36 2020-01-02 00:00:00+00:00 9 +37 2020-01-03 00:00:00+00:00 1 +38 2020-01-04 00:00:00+00:00 0 +39 2020-01-05 00:00:00+00:00 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_fill_nulls_with_0_month__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_fill_nulls_with_0_month__query_output.txt new file mode 100644 index 0000000000..78af74b1f8 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_fill_nulls_with_0_month__query_output.txt @@ -0,0 +1,25 @@ + metric_time__month bookings_fill_nulls_with_0 +0 2019-01-01 00:00:00+00:00 0 +1 2019-02-01 00:00:00+00:00 0 +2 2019-03-01 00:00:00+00:00 0 +3 2019-04-01 00:00:00+00:00 0 +4 2019-05-01 00:00:00+00:00 0 +5 2019-06-01 00:00:00+00:00 0 +6 2019-07-01 00:00:00+00:00 0 +7 2019-08-01 00:00:00+00:00 0 +8 2019-09-01 00:00:00+00:00 0 +9 2019-10-01 00:00:00+00:00 0 +10 2019-11-01 00:00:00+00:00 0 +11 2019-12-01 00:00:00+00:00 31 +12 2020-01-01 00:00:00+00:00 15 +13 2020-02-01 00:00:00+00:00 0 +14 2020-03-01 00:00:00+00:00 0 +15 2020-04-01 00:00:00+00:00 0 +16 2020-05-01 00:00:00+00:00 0 +17 2020-06-01 00:00:00+00:00 0 +18 2020-07-01 00:00:00+00:00 0 +19 2020-08-01 00:00:00+00:00 0 +20 2020-09-01 00:00:00+00:00 0 +21 2020-10-01 00:00:00+00:00 0 +22 2020-11-01 00:00:00+00:00 0 +23 2020-12-01 00:00:00+00:00 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_join_to_time_spine__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_join_to_time_spine__query_output.txt new file mode 100644 index 0000000000..3c824fc9af --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Databricks/test_simple_join_to_time_spine__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_join_to_time_spine +0 2019-11-27 00:00:00+00:00 NaN +1 2019-11-28 00:00:00+00:00 NaN +2 2019-11-29 00:00:00+00:00 NaN +3 2019-11-30 00:00:00+00:00 NaN +4 2019-12-01 00:00:00+00:00 1.0 +5 2019-12-02 00:00:00+00:00 NaN +6 2019-12-03 00:00:00+00:00 NaN +7 2019-12-04 00:00:00+00:00 NaN +8 2019-12-05 00:00:00+00:00 NaN +9 2019-12-06 00:00:00+00:00 NaN +10 2019-12-07 00:00:00+00:00 NaN +11 2019-12-08 00:00:00+00:00 NaN +12 2019-12-09 00:00:00+00:00 NaN +13 2019-12-10 00:00:00+00:00 NaN +14 2019-12-11 00:00:00+00:00 NaN +15 2019-12-12 00:00:00+00:00 NaN +16 2019-12-13 00:00:00+00:00 NaN +17 2019-12-14 00:00:00+00:00 NaN +18 2019-12-15 00:00:00+00:00 NaN +19 2019-12-16 00:00:00+00:00 NaN +20 2019-12-17 00:00:00+00:00 NaN +21 2019-12-18 00:00:00+00:00 10.0 +22 2019-12-19 00:00:00+00:00 18.0 +23 2019-12-20 00:00:00+00:00 2.0 +24 2019-12-21 00:00:00+00:00 NaN +25 2019-12-22 00:00:00+00:00 NaN +26 2019-12-23 00:00:00+00:00 NaN +27 2019-12-24 00:00:00+00:00 NaN +28 2019-12-25 00:00:00+00:00 NaN +29 2019-12-26 00:00:00+00:00 NaN +30 2019-12-27 00:00:00+00:00 NaN +31 2019-12-28 00:00:00+00:00 NaN +32 2019-12-29 00:00:00+00:00 NaN +33 2019-12-30 00:00:00+00:00 NaN +34 2019-12-31 00:00:00+00:00 NaN +35 2020-01-01 00:00:00+00:00 5.0 +36 2020-01-02 00:00:00+00:00 9.0 +37 2020-01-03 00:00:00+00:00 1.0 +38 2020-01-04 00:00:00+00:00 NaN +39 2020-01-05 00:00:00+00:00 NaN diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_fill_nulls_with_0_multi_metric_query__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_fill_nulls_with_0_multi_metric_query__query_output.txt new file mode 100644 index 0000000000..15d152a963 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_fill_nulls_with_0_multi_metric_query__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 views +0 2019-11-27 0 NaN +1 2019-11-28 0 NaN +2 2019-11-29 0 NaN +3 2019-11-30 0 NaN +4 2019-12-01 1 NaN +5 2019-12-02 0 NaN +6 2019-12-03 0 NaN +7 2019-12-04 0 NaN +8 2019-12-05 0 NaN +9 2019-12-06 0 NaN +10 2019-12-07 0 NaN +11 2019-12-08 0 NaN +12 2019-12-09 0 NaN +13 2019-12-10 0 NaN +14 2019-12-11 0 NaN +15 2019-12-12 0 NaN +16 2019-12-13 0 NaN +17 2019-12-14 0 NaN +18 2019-12-15 0 NaN +19 2019-12-16 0 NaN +20 2019-12-17 0 NaN +21 2019-12-18 10 NaN +22 2019-12-19 18 NaN +23 2019-12-20 2 NaN +24 2019-12-21 0 NaN +25 2019-12-22 0 NaN +26 2019-12-23 0 NaN +27 2019-12-24 0 NaN +28 2019-12-25 0 NaN +29 2019-12-26 0 NaN +30 2019-12-27 0 NaN +31 2019-12-28 0 NaN +32 2019-12-29 0 NaN +33 2019-12-30 0 NaN +34 2019-12-31 0 NaN +35 2020-01-01 5 2.0 +36 2020-01-02 9 5.0 +37 2020-01-03 1 NaN +38 2020-01-04 0 1.0 +39 2020-01-05 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt new file mode 100644 index 0000000000..f5bb2ed4ba --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt @@ -0,0 +1,16 @@ + metric_time__day listing__is_lux_latest bookings_fill_nulls_with_0_without_time_spine views +0 2019-12-01 True 1 NaN +1 2019-12-18 False 4 NaN +2 2019-12-18 True 6 NaN +3 2019-12-19 False 6 NaN +4 2019-12-19 True 6 NaN +5 2019-12-19 None 6 NaN +6 2019-12-20 True 2 NaN +7 2020-01-01 False 2 NaN +8 2020-01-01 True 3 2.0 +9 2020-01-02 False 3 3.0 +10 2020-01-02 True 3 1.0 +11 2020-01-02 None 3 1.0 +12 2020-01-03 True 1 NaN +13 2020-01-04 False 0 1.0 +14 2020-01-05 None 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_fill_nulls_with_0_metric_time__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_fill_nulls_with_0_metric_time__query_output.txt new file mode 100644 index 0000000000..7a4726bf18 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_fill_nulls_with_0_metric_time__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 +0 2019-11-27 0 +1 2019-11-28 0 +2 2019-11-29 0 +3 2019-11-30 0 +4 2019-12-01 1 +5 2019-12-02 0 +6 2019-12-03 0 +7 2019-12-04 0 +8 2019-12-05 0 +9 2019-12-06 0 +10 2019-12-07 0 +11 2019-12-08 0 +12 2019-12-09 0 +13 2019-12-10 0 +14 2019-12-11 0 +15 2019-12-12 0 +16 2019-12-13 0 +17 2019-12-14 0 +18 2019-12-15 0 +19 2019-12-16 0 +20 2019-12-17 0 +21 2019-12-18 10 +22 2019-12-19 18 +23 2019-12-20 2 +24 2019-12-21 0 +25 2019-12-22 0 +26 2019-12-23 0 +27 2019-12-24 0 +28 2019-12-25 0 +29 2019-12-26 0 +30 2019-12-27 0 +31 2019-12-28 0 +32 2019-12-29 0 +33 2019-12-30 0 +34 2019-12-31 0 +35 2020-01-01 5 +36 2020-01-02 9 +37 2020-01-03 1 +38 2020-01-04 0 +39 2020-01-05 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_fill_nulls_with_0_month__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_fill_nulls_with_0_month__query_output.txt new file mode 100644 index 0000000000..7ddd9fa0ea --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_fill_nulls_with_0_month__query_output.txt @@ -0,0 +1,25 @@ + metric_time__month bookings_fill_nulls_with_0 +0 2019-01-01 0 +1 2019-02-01 0 +2 2019-03-01 0 +3 2019-04-01 0 +4 2019-05-01 0 +5 2019-06-01 0 +6 2019-07-01 0 +7 2019-08-01 0 +8 2019-09-01 0 +9 2019-10-01 0 +10 2019-11-01 0 +11 2019-12-01 31 +12 2020-01-01 15 +13 2020-02-01 0 +14 2020-03-01 0 +15 2020-04-01 0 +16 2020-05-01 0 +17 2020-06-01 0 +18 2020-07-01 0 +19 2020-08-01 0 +20 2020-09-01 0 +21 2020-10-01 0 +22 2020-11-01 0 +23 2020-12-01 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_join_to_time_spine__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_join_to_time_spine__query_output.txt new file mode 100644 index 0000000000..2a91746dc1 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/DuckDB/test_simple_join_to_time_spine__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_join_to_time_spine +0 2019-11-27 NaN +1 2019-11-28 NaN +2 2019-11-29 NaN +3 2019-11-30 NaN +4 2019-12-01 1.0 +5 2019-12-02 NaN +6 2019-12-03 NaN +7 2019-12-04 NaN +8 2019-12-05 NaN +9 2019-12-06 NaN +10 2019-12-07 NaN +11 2019-12-08 NaN +12 2019-12-09 NaN +13 2019-12-10 NaN +14 2019-12-11 NaN +15 2019-12-12 NaN +16 2019-12-13 NaN +17 2019-12-14 NaN +18 2019-12-15 NaN +19 2019-12-16 NaN +20 2019-12-17 NaN +21 2019-12-18 10.0 +22 2019-12-19 18.0 +23 2019-12-20 2.0 +24 2019-12-21 NaN +25 2019-12-22 NaN +26 2019-12-23 NaN +27 2019-12-24 NaN +28 2019-12-25 NaN +29 2019-12-26 NaN +30 2019-12-27 NaN +31 2019-12-28 NaN +32 2019-12-29 NaN +33 2019-12-30 NaN +34 2019-12-31 NaN +35 2020-01-01 5.0 +36 2020-01-02 9.0 +37 2020-01-03 1.0 +38 2020-01-04 NaN +39 2020-01-05 NaN diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_fill_nulls_with_0_multi_metric_query__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_fill_nulls_with_0_multi_metric_query__query_output.txt new file mode 100644 index 0000000000..15d152a963 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_fill_nulls_with_0_multi_metric_query__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 views +0 2019-11-27 0 NaN +1 2019-11-28 0 NaN +2 2019-11-29 0 NaN +3 2019-11-30 0 NaN +4 2019-12-01 1 NaN +5 2019-12-02 0 NaN +6 2019-12-03 0 NaN +7 2019-12-04 0 NaN +8 2019-12-05 0 NaN +9 2019-12-06 0 NaN +10 2019-12-07 0 NaN +11 2019-12-08 0 NaN +12 2019-12-09 0 NaN +13 2019-12-10 0 NaN +14 2019-12-11 0 NaN +15 2019-12-12 0 NaN +16 2019-12-13 0 NaN +17 2019-12-14 0 NaN +18 2019-12-15 0 NaN +19 2019-12-16 0 NaN +20 2019-12-17 0 NaN +21 2019-12-18 10 NaN +22 2019-12-19 18 NaN +23 2019-12-20 2 NaN +24 2019-12-21 0 NaN +25 2019-12-22 0 NaN +26 2019-12-23 0 NaN +27 2019-12-24 0 NaN +28 2019-12-25 0 NaN +29 2019-12-26 0 NaN +30 2019-12-27 0 NaN +31 2019-12-28 0 NaN +32 2019-12-29 0 NaN +33 2019-12-30 0 NaN +34 2019-12-31 0 NaN +35 2020-01-01 5 2.0 +36 2020-01-02 9 5.0 +37 2020-01-03 1 NaN +38 2020-01-04 0 1.0 +39 2020-01-05 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt new file mode 100644 index 0000000000..f5bb2ed4ba --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt @@ -0,0 +1,16 @@ + metric_time__day listing__is_lux_latest bookings_fill_nulls_with_0_without_time_spine views +0 2019-12-01 True 1 NaN +1 2019-12-18 False 4 NaN +2 2019-12-18 True 6 NaN +3 2019-12-19 False 6 NaN +4 2019-12-19 True 6 NaN +5 2019-12-19 None 6 NaN +6 2019-12-20 True 2 NaN +7 2020-01-01 False 2 NaN +8 2020-01-01 True 3 2.0 +9 2020-01-02 False 3 3.0 +10 2020-01-02 True 3 1.0 +11 2020-01-02 None 3 1.0 +12 2020-01-03 True 1 NaN +13 2020-01-04 False 0 1.0 +14 2020-01-05 None 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_fill_nulls_with_0_metric_time__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_fill_nulls_with_0_metric_time__query_output.txt new file mode 100644 index 0000000000..7a4726bf18 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_fill_nulls_with_0_metric_time__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 +0 2019-11-27 0 +1 2019-11-28 0 +2 2019-11-29 0 +3 2019-11-30 0 +4 2019-12-01 1 +5 2019-12-02 0 +6 2019-12-03 0 +7 2019-12-04 0 +8 2019-12-05 0 +9 2019-12-06 0 +10 2019-12-07 0 +11 2019-12-08 0 +12 2019-12-09 0 +13 2019-12-10 0 +14 2019-12-11 0 +15 2019-12-12 0 +16 2019-12-13 0 +17 2019-12-14 0 +18 2019-12-15 0 +19 2019-12-16 0 +20 2019-12-17 0 +21 2019-12-18 10 +22 2019-12-19 18 +23 2019-12-20 2 +24 2019-12-21 0 +25 2019-12-22 0 +26 2019-12-23 0 +27 2019-12-24 0 +28 2019-12-25 0 +29 2019-12-26 0 +30 2019-12-27 0 +31 2019-12-28 0 +32 2019-12-29 0 +33 2019-12-30 0 +34 2019-12-31 0 +35 2020-01-01 5 +36 2020-01-02 9 +37 2020-01-03 1 +38 2020-01-04 0 +39 2020-01-05 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_fill_nulls_with_0_month__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_fill_nulls_with_0_month__query_output.txt new file mode 100644 index 0000000000..7ddd9fa0ea --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_fill_nulls_with_0_month__query_output.txt @@ -0,0 +1,25 @@ + metric_time__month bookings_fill_nulls_with_0 +0 2019-01-01 0 +1 2019-02-01 0 +2 2019-03-01 0 +3 2019-04-01 0 +4 2019-05-01 0 +5 2019-06-01 0 +6 2019-07-01 0 +7 2019-08-01 0 +8 2019-09-01 0 +9 2019-10-01 0 +10 2019-11-01 0 +11 2019-12-01 31 +12 2020-01-01 15 +13 2020-02-01 0 +14 2020-03-01 0 +15 2020-04-01 0 +16 2020-05-01 0 +17 2020-06-01 0 +18 2020-07-01 0 +19 2020-08-01 0 +20 2020-09-01 0 +21 2020-10-01 0 +22 2020-11-01 0 +23 2020-12-01 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_join_to_time_spine__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_join_to_time_spine__query_output.txt new file mode 100644 index 0000000000..2a91746dc1 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Postgres/test_simple_join_to_time_spine__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_join_to_time_spine +0 2019-11-27 NaN +1 2019-11-28 NaN +2 2019-11-29 NaN +3 2019-11-30 NaN +4 2019-12-01 1.0 +5 2019-12-02 NaN +6 2019-12-03 NaN +7 2019-12-04 NaN +8 2019-12-05 NaN +9 2019-12-06 NaN +10 2019-12-07 NaN +11 2019-12-08 NaN +12 2019-12-09 NaN +13 2019-12-10 NaN +14 2019-12-11 NaN +15 2019-12-12 NaN +16 2019-12-13 NaN +17 2019-12-14 NaN +18 2019-12-15 NaN +19 2019-12-16 NaN +20 2019-12-17 NaN +21 2019-12-18 10.0 +22 2019-12-19 18.0 +23 2019-12-20 2.0 +24 2019-12-21 NaN +25 2019-12-22 NaN +26 2019-12-23 NaN +27 2019-12-24 NaN +28 2019-12-25 NaN +29 2019-12-26 NaN +30 2019-12-27 NaN +31 2019-12-28 NaN +32 2019-12-29 NaN +33 2019-12-30 NaN +34 2019-12-31 NaN +35 2020-01-01 5.0 +36 2020-01-02 9.0 +37 2020-01-03 1.0 +38 2020-01-04 NaN +39 2020-01-05 NaN diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_fill_nulls_with_0_multi_metric_query__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_fill_nulls_with_0_multi_metric_query__query_output.txt new file mode 100644 index 0000000000..15d152a963 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_fill_nulls_with_0_multi_metric_query__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 views +0 2019-11-27 0 NaN +1 2019-11-28 0 NaN +2 2019-11-29 0 NaN +3 2019-11-30 0 NaN +4 2019-12-01 1 NaN +5 2019-12-02 0 NaN +6 2019-12-03 0 NaN +7 2019-12-04 0 NaN +8 2019-12-05 0 NaN +9 2019-12-06 0 NaN +10 2019-12-07 0 NaN +11 2019-12-08 0 NaN +12 2019-12-09 0 NaN +13 2019-12-10 0 NaN +14 2019-12-11 0 NaN +15 2019-12-12 0 NaN +16 2019-12-13 0 NaN +17 2019-12-14 0 NaN +18 2019-12-15 0 NaN +19 2019-12-16 0 NaN +20 2019-12-17 0 NaN +21 2019-12-18 10 NaN +22 2019-12-19 18 NaN +23 2019-12-20 2 NaN +24 2019-12-21 0 NaN +25 2019-12-22 0 NaN +26 2019-12-23 0 NaN +27 2019-12-24 0 NaN +28 2019-12-25 0 NaN +29 2019-12-26 0 NaN +30 2019-12-27 0 NaN +31 2019-12-28 0 NaN +32 2019-12-29 0 NaN +33 2019-12-30 0 NaN +34 2019-12-31 0 NaN +35 2020-01-01 5 2.0 +36 2020-01-02 9 5.0 +37 2020-01-03 1 NaN +38 2020-01-04 0 1.0 +39 2020-01-05 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt new file mode 100644 index 0000000000..f5bb2ed4ba --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt @@ -0,0 +1,16 @@ + metric_time__day listing__is_lux_latest bookings_fill_nulls_with_0_without_time_spine views +0 2019-12-01 True 1 NaN +1 2019-12-18 False 4 NaN +2 2019-12-18 True 6 NaN +3 2019-12-19 False 6 NaN +4 2019-12-19 True 6 NaN +5 2019-12-19 None 6 NaN +6 2019-12-20 True 2 NaN +7 2020-01-01 False 2 NaN +8 2020-01-01 True 3 2.0 +9 2020-01-02 False 3 3.0 +10 2020-01-02 True 3 1.0 +11 2020-01-02 None 3 1.0 +12 2020-01-03 True 1 NaN +13 2020-01-04 False 0 1.0 +14 2020-01-05 None 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_fill_nulls_with_0_metric_time__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_fill_nulls_with_0_metric_time__query_output.txt new file mode 100644 index 0000000000..7a4726bf18 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_fill_nulls_with_0_metric_time__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_fill_nulls_with_0 +0 2019-11-27 0 +1 2019-11-28 0 +2 2019-11-29 0 +3 2019-11-30 0 +4 2019-12-01 1 +5 2019-12-02 0 +6 2019-12-03 0 +7 2019-12-04 0 +8 2019-12-05 0 +9 2019-12-06 0 +10 2019-12-07 0 +11 2019-12-08 0 +12 2019-12-09 0 +13 2019-12-10 0 +14 2019-12-11 0 +15 2019-12-12 0 +16 2019-12-13 0 +17 2019-12-14 0 +18 2019-12-15 0 +19 2019-12-16 0 +20 2019-12-17 0 +21 2019-12-18 10 +22 2019-12-19 18 +23 2019-12-20 2 +24 2019-12-21 0 +25 2019-12-22 0 +26 2019-12-23 0 +27 2019-12-24 0 +28 2019-12-25 0 +29 2019-12-26 0 +30 2019-12-27 0 +31 2019-12-28 0 +32 2019-12-29 0 +33 2019-12-30 0 +34 2019-12-31 0 +35 2020-01-01 5 +36 2020-01-02 9 +37 2020-01-03 1 +38 2020-01-04 0 +39 2020-01-05 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_fill_nulls_with_0_month__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_fill_nulls_with_0_month__query_output.txt new file mode 100644 index 0000000000..7ddd9fa0ea --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_fill_nulls_with_0_month__query_output.txt @@ -0,0 +1,25 @@ + metric_time__month bookings_fill_nulls_with_0 +0 2019-01-01 0 +1 2019-02-01 0 +2 2019-03-01 0 +3 2019-04-01 0 +4 2019-05-01 0 +5 2019-06-01 0 +6 2019-07-01 0 +7 2019-08-01 0 +8 2019-09-01 0 +9 2019-10-01 0 +10 2019-11-01 0 +11 2019-12-01 31 +12 2020-01-01 15 +13 2020-02-01 0 +14 2020-03-01 0 +15 2020-04-01 0 +16 2020-05-01 0 +17 2020-06-01 0 +18 2020-07-01 0 +19 2020-08-01 0 +20 2020-09-01 0 +21 2020-10-01 0 +22 2020-11-01 0 +23 2020-12-01 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_join_to_time_spine__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_join_to_time_spine__query_output.txt new file mode 100644 index 0000000000..2a91746dc1 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Redshift/test_simple_join_to_time_spine__query_output.txt @@ -0,0 +1,41 @@ + metric_time__day bookings_join_to_time_spine +0 2019-11-27 NaN +1 2019-11-28 NaN +2 2019-11-29 NaN +3 2019-11-30 NaN +4 2019-12-01 1.0 +5 2019-12-02 NaN +6 2019-12-03 NaN +7 2019-12-04 NaN +8 2019-12-05 NaN +9 2019-12-06 NaN +10 2019-12-07 NaN +11 2019-12-08 NaN +12 2019-12-09 NaN +13 2019-12-10 NaN +14 2019-12-11 NaN +15 2019-12-12 NaN +16 2019-12-13 NaN +17 2019-12-14 NaN +18 2019-12-15 NaN +19 2019-12-16 NaN +20 2019-12-17 NaN +21 2019-12-18 10.0 +22 2019-12-19 18.0 +23 2019-12-20 2.0 +24 2019-12-21 NaN +25 2019-12-22 NaN +26 2019-12-23 NaN +27 2019-12-24 NaN +28 2019-12-25 NaN +29 2019-12-26 NaN +30 2019-12-27 NaN +31 2019-12-28 NaN +32 2019-12-29 NaN +33 2019-12-30 NaN +34 2019-12-31 NaN +35 2020-01-01 5.0 +36 2020-01-02 9.0 +37 2020-01-03 1.0 +38 2020-01-04 NaN +39 2020-01-05 NaN diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_fill_nulls_with_0_multi_metric_query__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_fill_nulls_with_0_multi_metric_query__query_output.txt new file mode 100644 index 0000000000..5c533bbad5 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_fill_nulls_with_0_multi_metric_query__query_output.txt @@ -0,0 +1,41 @@ + METRIC_TIME__DAY BOOKINGS_FILL_NULLS_WITH_0 VIEWS +0 2019-11-27 0 NaN +1 2019-11-28 0 NaN +2 2019-11-29 0 NaN +3 2019-11-30 0 NaN +4 2019-12-01 1 NaN +5 2019-12-02 0 NaN +6 2019-12-03 0 NaN +7 2019-12-04 0 NaN +8 2019-12-05 0 NaN +9 2019-12-06 0 NaN +10 2019-12-07 0 NaN +11 2019-12-08 0 NaN +12 2019-12-09 0 NaN +13 2019-12-10 0 NaN +14 2019-12-11 0 NaN +15 2019-12-12 0 NaN +16 2019-12-13 0 NaN +17 2019-12-14 0 NaN +18 2019-12-15 0 NaN +19 2019-12-16 0 NaN +20 2019-12-17 0 NaN +21 2019-12-18 10 NaN +22 2019-12-19 18 NaN +23 2019-12-20 2 NaN +24 2019-12-21 0 NaN +25 2019-12-22 0 NaN +26 2019-12-23 0 NaN +27 2019-12-24 0 NaN +28 2019-12-25 0 NaN +29 2019-12-26 0 NaN +30 2019-12-27 0 NaN +31 2019-12-28 0 NaN +32 2019-12-29 0 NaN +33 2019-12-30 0 NaN +34 2019-12-31 0 NaN +35 2020-01-01 5 2.0 +36 2020-01-02 9 5.0 +37 2020-01-03 1 NaN +38 2020-01-04 0 1.0 +39 2020-01-05 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt new file mode 100644 index 0000000000..16b71cd5ef --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_fill_nulls_with_0_multi_metric_query_with_categorical_dimension__query_output.txt @@ -0,0 +1,16 @@ + METRIC_TIME__DAY LISTING__IS_LUX_LATEST BOOKINGS_FILL_NULLS_WITH_0_WITHOUT_TIME_SPINE VIEWS +0 2019-12-01 True 1 NaN +1 2019-12-18 False 4 NaN +2 2019-12-18 True 6 NaN +3 2019-12-19 False 6 NaN +4 2019-12-19 True 6 NaN +5 2019-12-19 None 6 NaN +6 2019-12-20 True 2 NaN +7 2020-01-01 False 2 NaN +8 2020-01-01 True 3 2.0 +9 2020-01-02 False 3 3.0 +10 2020-01-02 True 3 1.0 +11 2020-01-02 None 3 1.0 +12 2020-01-03 True 1 NaN +13 2020-01-04 False 0 1.0 +14 2020-01-05 None 0 1.0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_fill_nulls_with_0_metric_time__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_fill_nulls_with_0_metric_time__query_output.txt new file mode 100644 index 0000000000..64b2c5573e --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_fill_nulls_with_0_metric_time__query_output.txt @@ -0,0 +1,41 @@ + METRIC_TIME__DAY BOOKINGS_FILL_NULLS_WITH_0 +0 2019-11-27 0 +1 2019-11-28 0 +2 2019-11-29 0 +3 2019-11-30 0 +4 2019-12-01 1 +5 2019-12-02 0 +6 2019-12-03 0 +7 2019-12-04 0 +8 2019-12-05 0 +9 2019-12-06 0 +10 2019-12-07 0 +11 2019-12-08 0 +12 2019-12-09 0 +13 2019-12-10 0 +14 2019-12-11 0 +15 2019-12-12 0 +16 2019-12-13 0 +17 2019-12-14 0 +18 2019-12-15 0 +19 2019-12-16 0 +20 2019-12-17 0 +21 2019-12-18 10 +22 2019-12-19 18 +23 2019-12-20 2 +24 2019-12-21 0 +25 2019-12-22 0 +26 2019-12-23 0 +27 2019-12-24 0 +28 2019-12-25 0 +29 2019-12-26 0 +30 2019-12-27 0 +31 2019-12-28 0 +32 2019-12-29 0 +33 2019-12-30 0 +34 2019-12-31 0 +35 2020-01-01 5 +36 2020-01-02 9 +37 2020-01-03 1 +38 2020-01-04 0 +39 2020-01-05 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_fill_nulls_with_0_month__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_fill_nulls_with_0_month__query_output.txt new file mode 100644 index 0000000000..da157cd286 --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_fill_nulls_with_0_month__query_output.txt @@ -0,0 +1,25 @@ + METRIC_TIME__MONTH BOOKINGS_FILL_NULLS_WITH_0 +0 2019-01-01 0 +1 2019-02-01 0 +2 2019-03-01 0 +3 2019-04-01 0 +4 2019-05-01 0 +5 2019-06-01 0 +6 2019-07-01 0 +7 2019-08-01 0 +8 2019-09-01 0 +9 2019-10-01 0 +10 2019-11-01 0 +11 2019-12-01 31 +12 2020-01-01 15 +13 2020-02-01 0 +14 2020-03-01 0 +15 2020-04-01 0 +16 2020-05-01 0 +17 2020-06-01 0 +18 2020-07-01 0 +19 2020-08-01 0 +20 2020-09-01 0 +21 2020-10-01 0 +22 2020-11-01 0 +23 2020-12-01 0 diff --git a/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_join_to_time_spine__query_output.txt b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_join_to_time_spine__query_output.txt new file mode 100644 index 0000000000..fa7297366c --- /dev/null +++ b/metricflow/test/snapshots/test_fill_nulls_with_0.py/str/Snowflake/test_simple_join_to_time_spine__query_output.txt @@ -0,0 +1,41 @@ + METRIC_TIME__DAY BOOKINGS_JOIN_TO_TIME_SPINE +0 2019-11-27 NaN +1 2019-11-28 NaN +2 2019-11-29 NaN +3 2019-11-30 NaN +4 2019-12-01 1.0 +5 2019-12-02 NaN +6 2019-12-03 NaN +7 2019-12-04 NaN +8 2019-12-05 NaN +9 2019-12-06 NaN +10 2019-12-07 NaN +11 2019-12-08 NaN +12 2019-12-09 NaN +13 2019-12-10 NaN +14 2019-12-11 NaN +15 2019-12-12 NaN +16 2019-12-13 NaN +17 2019-12-14 NaN +18 2019-12-15 NaN +19 2019-12-16 NaN +20 2019-12-17 NaN +21 2019-12-18 10.0 +22 2019-12-19 18.0 +23 2019-12-20 2.0 +24 2019-12-21 NaN +25 2019-12-22 NaN +26 2019-12-23 NaN +27 2019-12-24 NaN +28 2019-12-25 NaN +29 2019-12-26 NaN +30 2019-12-27 NaN +31 2019-12-28 NaN +32 2019-12-29 NaN +33 2019-12-30 NaN +34 2019-12-31 NaN +35 2020-01-01 5.0 +36 2020-01-02 9.0 +37 2020-01-03 1.0 +38 2020-01-04 NaN +39 2020-01-05 NaN diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 241e16efe2..21c9bba162 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day - , MAX(subq_7.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_15.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index f2c1764b36..fe0a20f6f9 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day - , MAX(subq_24.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_24.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_32.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql index d107d58633..2e3efcf3fc 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day - , MAX(subq_7.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_15.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index ca26d38ede..9381558d74 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day - , MAX(subq_24.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_24.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_32.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 82f482abd5..5c9c395244 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day - , MAX(subq_7.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_15.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index 09cde7d286..a47a257565 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day - , MAX(subq_24.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_24.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_32.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 8c871556dc..039bc21b06 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day - , MAX(subq_7.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_15.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index d8cf4d63f9..4229113c37 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day - , MAX(subq_24.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_24.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_32.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql index f6f0f67739..8f3ebe8e9e 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day - , MAX(subq_7.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_15.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index ca26d38ede..9381558d74 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day - , MAX(subq_24.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_24.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_32.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 4193003958..77072714d4 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day - , MAX(subq_7.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_7.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_15.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions diff --git a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql index ca26d38ede..9381558d74 100644 --- a/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0_optimized.sql @@ -6,7 +6,7 @@ FROM ( -- Combine Metrics SELECT COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day - , MAX(subq_24.bookings_fill_nulls_with_0) AS bookings_fill_nulls_with_0 + , COALESCE(MAX(subq_24.bookings_fill_nulls_with_0), 0) AS bookings_fill_nulls_with_0 , MAX(subq_32.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( -- Compute Metrics via Expressions