Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20251017-065915.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Improve time filter debug messages in dataflow plan builder for better troubleshooting
time: 2025-10-17T06:59:15.56707+09:00
custom:
Author: kiwamizamurai
Issue: "1913"
34 changes: 28 additions & 6 deletions metricflow/dataflow/builder/dataflow_plan_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,10 @@ def _build_aggregated_simple_metric_input(
if cumulative and predicate_pushdown_state.time_range_constraint is not None:
logger.debug(
LazyFormat(
lambda: f"Time range constraint before adjustment is {predicate_pushdown_state.time_range_constraint}"
lambda: (
f"Adjusting time range constraint for cumulative metric '{simple_metric_input.name}'. "
f"Original constraint: {predicate_pushdown_state.time_range_constraint}"
)
)
)
granularity: Optional[TimeGranularity] = None
Expand All @@ -1805,7 +1808,13 @@ def _build_aggregated_simple_metric_input(
)
)
logger.debug(
LazyFormat(lambda: f"Adjusted time range constraint to: {cumulative_metric_adjusted_time_constraint}")
LazyFormat(
lambda: (
f"Time range constraint adjusted for cumulative metric '{simple_metric_input.name}' "
f"with window (granularity={granularity}, count={count}). "
f"New constraint: {cumulative_metric_adjusted_time_constraint}"
)
)
)

required_linkable_specs = self.__get_required_linkable_specs(
Expand All @@ -1830,10 +1839,12 @@ def _build_aggregated_simple_metric_input(
if source_node_recipe is None:
logger.debug(
LazyFormat(
"Looking for a simple metric recipe",
simple_metric=simple_metric_recipe.simple_metric_input.name,
spec_properties=spec_properties,
required_linkable_specs=required_linkable_specs,
lambda: (
f"Building source node recipe for simple metric '{simple_metric_recipe.simple_metric_input.name}'. "
f"Required dimensions: {[spec.element_name for spec in required_linkable_specs.dimension_specs] if required_linkable_specs.dimension_specs else []}, "
f"Required time dimensions: {[spec.element_name for spec in required_linkable_specs.time_dimension_specs] if required_linkable_specs.time_dimension_specs else []}, "
f"Has filters: {len(simple_metric_recipe.combined_filter_spec_set.all_filter_specs) > 0}"
)
)
)

Expand All @@ -1842,6 +1853,17 @@ def _build_aggregated_simple_metric_input(
if not uses_offset # Time constraints will be applied after offset
else None
)

if uses_offset and predicate_pushdown_state.time_range_constraint:
logger.debug(
LazyFormat(
lambda: (
f"Time constraint will be applied after offset for metric '{simple_metric_recipe.simple_metric_input.name}'. "
f"Constraint: {predicate_pushdown_state.time_range_constraint}"
)
)
)

if time_constraint is None:
simple_metric_input_ppd_state = PredicatePushdownState.without_time_range_constraint(
predicate_pushdown_state
Expand Down