code: def _get_execution_dag(
      executor: Executor,
      plan: ExecutionPlan,
      allow_clear_input_blocks: bool,
      preserve_order: bool,
  ) -> Tuple[PhysicalOperator, DatasetStats]:
      """Get the physical operators DAG from a plan."""
      # Record usage of logical operators if available.
      if (
          hasattr(plan, "_logical_plan")
          and plan._logical_plan is not None
      ):
          record_operators_usage(plan._logical_plan.dag)
  
      # Get DAG of physical operators and input statistics.
      dag = get_execution_plan(plan._logical_plan).dag
      stats = _get_initial_stats_from_plan(plan)
  
      # Enforce to preserve ordering if the plan has stages required to do so, such as
      # Zip and Sort.
      # TODO(chengsu): implement this for operator as well.
      if preserve_order or plan.require_preserve_order():
          executor._options.preserve_order = True
  
      return dag, stats
  
imports: from typing import Iterator, Tuple
  from ray.data._internal.block_list import BlockList
  from ray.data._internal.execution.interfaces import Executor, PhysicalOperator, RefBundle
  from ray.data._internal.lazy_block_list import LazyBlockList
  from ray.data._internal.logical.interfaces.logical_plan import LogicalPlan
  from ray.data._internal.logical.operators.read_operator import Read
  from ray.data._internal.logical.optimizers import get_execution_plan
  from ray.data._internal.logical.rules.set_read_parallelism import compute_additional_split_factor
  from ray.data._internal.logical.util import record_operators_usage
  from ray.data._internal.plan import ExecutionPlan
  from ray.data._internal.planner.plan_read_op import apply_output_blocks_handling_to_read_task
  from ray.data._internal.stats import DatasetStats
  from ray.data.block import Block, BlockMetadata, List
  from ray.data.context import DataContext
  from ray.types import ObjectRef
label_desc: Use image node_id 5 for calling a global function with example usage: _get_execution_dag(executor, plan, allow_clear_input_blocks, preserve_order) and returns: dag,  stats