code: def test_randomize_blocks_rule_e2e(
      ray_start_regular_shared, enable_optimizer
  ):
      def dummy_map(x):
          return x
  
      ds = (
          ray.data.range(10)
          .randomize_block_order()
          .map_batches(dummy_map)
      )
      plan = ds._logical_plan
      optimized_plan = LogicalOptimizer().optimize(plan)
  
      inverse_order = iter([Read, AbstractUDFMap, RandomizeBlocks])
      for node in optimized_plan.dag.post_order_iter():
          assert isinstance(node, next(inverse_order))
  
      ds = (
          ray.data.range(10)
          .randomize_block_order()
          .repartition(10)
          .map_batches(dummy_map)
      )
      plan = ds._logical_plan
      optimized_plan = LogicalOptimizer().optimize(plan)
  
      inverse_order = iter(
          [Read, RandomizeBlocks, Repartition, AbstractUDFMap]
      )
      for node in optimized_plan.dag.post_order_iter():
          assert isinstance(node, next(inverse_order))
  
file_path: ray/python/ray/data/tests/test_randomize_block_order.py
imports: import pytest
  import ray
  from ray.data._internal.execution.operators.base_physical_operator import AllToAllOperator
  from ray.data._internal.execution.operators.map_operator import MapOperator
  from ray.data._internal.logical.interfaces import LogicalPlan
  from ray.data._internal.logical.operators.all_to_all_operator import RandomizeBlocks, Repartition
  from ray.data._internal.logical.operators.map_operator import AbstractUDFMap, MapBatches
  from ray.data._internal.logical.operators.read_operator import Read
  from ray.data._internal.logical.optimizers import LogicalOptimizer
  from ray.data._internal.logical.rules.randomize_blocks import ReorderRandomizeBlocksRule
  from ray.data._internal.planner.planner import Planner
  from ray.data.tests.test_util import get_parquet_read_logical_op
  from ray.data.tests.util import extract_values
label_desc: Use image node_id 6 for calling a global function with example usage: test_randomize_blocks_rule_e2e(ray_start_regular_shared, enable_optimizer) and returns: x