code: def test_randomize_block_order_rule_seed():
      read = get_parquet_read_logical_op()
      operator1 = RandomizeBlocks(input_op=read, seed=None)
      operator2 = RandomizeBlocks(input_op=operator1, seed=2)
      operator3 = MapBatches(input_op=operator2, fn=lambda x: x)
      original_plan = LogicalPlan(dag=operator3)
  
      rule = ReorderRandomizeBlocksRule()
      optimized_plan = rule.apply(original_plan)
  
      # Check that RandomizeBlocks is the last operator in the DAG.
      assert isinstance(optimized_plan.dag, RandomizeBlocks)
      # Check that the seed is maintained.
      assert optimized_plan.dag._seed == 2
  
      # Check that the two RandomizeBlocks operators are not collapsed since seeds are
      # provided.
      assert isinstance(
          optimized_plan.dag.input_dependencies[0], RandomizeBlocks
      )
      assert optimized_plan.dag.input_dependencies[0]._seed is None
      operator_count = 0
      for _ in optimized_plan.dag.post_order_iter():
          operator_count += 1
  
      # RandomizeBlocks operators should not be deduped.
      assert operator_count == 4
  
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 3 for calling a global function with example usage: test_randomize_block_order_rule_seed() without return types