code: def test_map_batches_batch_zero_copy(
      ray_start_regular_shared, num_rows, num_blocks, batch_size
  ):
      # Test that batches are zero-copy read-only views when zero_copy_batch=True.
      def mutate(df):
          # Check that batch is read-only.
          assert not df.values.flags.writeable
          df["id"] += 1
          return df
  
      ds = ray.data.range(num_rows, parallelism=num_blocks).repartition(
          num_blocks
      )
      # Convert to Pandas blocks.
      ds = ds.map_batches(
          lambda df: df, batch_format="pandas", batch_size=None
      )
      ds = ds.materialize()
  
      # Apply UDF that mutates the batches, which should fail since the batch is
      # read-only.
      with pytest.raises(
          ValueError,
          match="tried to mutate a zero-copy read-only batch",
      ):
          ds = ds.map_batches(
              mutate,
              batch_format="pandas",
              batch_size=batch_size,
              zero_copy_batch=True,
          )
          ds.materialize()
  
imports: import itertools
  import math
  import os
  import signal
  import threading
  import time
  from typing import Iterator
  import numpy
  import pandas
  import pyarrow
  import pyarrow.parquet
  import pytest
  import ray
  from ray._private.test_utils import wait_for_condition
  from ray.data.block import BlockAccessor
  from ray.data.context import DataContext
  from ray.data.tests.conftest import *
  from ray.data.tests.util import column_udf, column_udf_class, extract_values
  from ray.tests.conftest import *
label_desc: Use image node_id 15 for calling a global function with example usage: test_map_batches_batch_zero_copy(ray_start_regular_shared, num_rows, num_blocks, batch_size) and returns: df