Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Apr 9, 2024
2 parents 2d45143 + 72f7d6e commit 4535ddb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240409-112145.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Improve error messages for dataflow plan failures.
time: 2024-04-09T11:21:45.068428-07:00
custom:
Author: courtneyholcomb
Issue: "1118"
9 changes: 4 additions & 5 deletions metricflow/dataflow/builder/dataflow_plan_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ def _build_aggregated_conversion_node(
logger.info(f"Recipe for conversion measure aggregation:\n{mf_pformat(conversion_measure_recipe)}")
if base_measure_recipe is None:
raise UnableToSatisfyQueryError(
f"Recipe not found for measure spec: {base_measure_spec.measure_spec} and linkable specs: {base_required_linkable_specs}"
f"Unable to join all items in request. Measure: {base_measure_spec.measure_spec}; Specs to join: {base_required_linkable_specs}"
)
if conversion_measure_recipe is None:
raise UnableToSatisfyQueryError(
f"Recipe not found for measure spec: {conversion_measure_spec.measure_spec}"
f"Unable to build dataflow plan for conversion measure: {conversion_measure_spec.measure_spec}"
)

# Gets the aggregated opportunities
Expand Down Expand Up @@ -651,7 +651,7 @@ def _build_plan_for_distinct_values(self, query_spec: MetricFlowQuerySpec) -> Da
linkable_spec_set=required_linkable_specs, time_range_constraint=query_spec.time_range_constraint
)
if not dataflow_recipe:
raise UnableToSatisfyQueryError(f"Recipe not found for linkable specs: {required_linkable_specs}")
raise UnableToSatisfyQueryError(f"Unable to join all items in request: {required_linkable_specs}")

output_node = dataflow_recipe.source_node
if dataflow_recipe.join_targets:
Expand Down Expand Up @@ -1298,9 +1298,8 @@ def _build_aggregated_measure_from_measure_source_node(
logger.info(f"Using recipe:\n{indent(mf_pformat(measure_recipe))}")

if measure_recipe is None:
# TODO: Improve for better user understandability.
raise UnableToSatisfyQueryError(
f"Recipe not found for measure spec: {measure_spec} and linkable specs: {required_linkable_specs}"
f"Unable to join all items in request. Measure: {measure_spec.element_name}; Specs to join: {required_linkable_specs}"
)

queried_agg_time_dimension_specs = queried_linkable_specs.included_agg_time_dimension_specs_for_measure(
Expand Down
13 changes: 12 additions & 1 deletion tests/integration/test_cases/itest_dimensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,18 @@ integration_test:
{{ render_date_trunc("v.ds", TimeGranularity.MONTH) }}
)
---
integration_test:
name: min_max_metric_time
description: Get min and max of metric_time
model: SIMPLE_MODEL
group_bys: ["metric_time"]
min_max_only: true
check_query: |
SELECT
MIN({{ render_date_trunc('ds', TimeGranularity.DAY) }}) AS metric_time__day__min
, MAX({{ render_date_trunc('ds', TimeGranularity.DAY) }}) AS metric_time__day__max
FROM {{ source_schema }}.mf_time_spine
---
integration_test:
name: distinct_values_query_with_metric_filter
description: Query withought metrics using a metric filter
Expand All @@ -358,4 +370,3 @@ integration_test:
)
WHERE listing__bookings > 2
GROUP BY listing
# TODO: add test case for range of metric time values

0 comments on commit 4535ddb

Please sign in to comment.