code: def test_constrained_metric_not_combined(  # noqa: D
      request: FixtureRequest,
      mf_test_session_state: MetricFlowTestSessionState,
      column_association_resolver: ColumnAssociationResolver,
      dataflow_plan_builder: DataflowPlanBuilder,
      query_parser: MetricFlowQueryParser,
  ) -> None:
      """Tests that 2 metrics from the same semantic model but where 1 is constrained results in 2 scans.
  
      If there is a constraint for a metric, it needs to be handled in a separate query because the constraint applies to
      all rows.
      """
      query_spec = query_parser.parse_and_validate_query(
          metric_names=("booking_value", "instant_booking_value"),
          group_by_names=(METRIC_TIME_ELEMENT_NAME,),
      )
      check_optimization(
          request=request,
          mf_test_session_state=mf_test_session_state,
          dataflow_plan_builder=dataflow_plan_builder,
          query_spec=query_spec,
          expected_num_sources_in_unoptimized=2,
          expected_num_sources_in_optimized=2,
      )
  
imports: from __future__ import annotations
  import logging
  import pytest
  from _pytest.fixtures import FixtureRequest
  from dbt_semantic_interfaces.naming.keywords import METRIC_TIME_ELEMENT_NAME
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from metricflow.dataflow.builder.dataflow_plan_builder import DataflowPlanBuilder
  from metricflow.dataflow.dataflow_plan import AddGeneratedUuidColumnNode, AggregateMeasuresNode, CombineAggregatedOutputsNode, ComputeMetricsNode, ConstrainTimeRangeNode, DataflowPlan, DataflowPlanNode, DataflowPlanNodeVisitor, FilterElementsNode, JoinConversionEventsNode, JoinOverTimeRangeNode, JoinToBaseOutputNode, JoinToTimeSpineNode, MetricTimeDimensionTransformNode, MinMaxNode, OrderByLimitNode, ReadSqlSourceNode, SemiAdditiveJoinNode, WhereConstraintNode, WriteToResultDataframeNode, WriteToResultTableNode
  from metricflow.dataflow.dataflow_plan_to_text import dataflow_plan_as_text
  from metricflow.dataflow.optimizer.source_scan.source_scan_optimizer import SourceScanOptimizer
  from metricflow.dataset.dataset import DataSet
  from metricflow.query.query_parser import MetricFlowQueryParser
  from metricflow.specs.column_assoc import ColumnAssociationResolver
  from metricflow.specs.specs import DimensionSpec, EntityReference, MetricFlowQuerySpec, MetricSpec
  from metricflow.test.dataflow_plan_to_svg import display_graph_if_requested
  from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState
  from metricflow.test.snapshot_utils import assert_plan_snapshot_text_equal
label_desc: Use image node_id 5 for calling a global function with example usage: test_constrained_metric_not_combined(request, mf_test_session_state, column_association_resolver, dataflow_plan_builder, query_parser) without return types