code: def test_map_chunk_execution(setup):
      raw = pd.DataFrame(
          np.random.rand(10, 5), columns=[f"col{i}" for i in range(5)]
      )
  
      df = from_pandas_df(raw, chunk_size=(5, 3))
  
      def f1(pdf):
          return pdf + 1
  
      r = df.map_chunk(f1)
  
      result = r.execute().fetch()
      expected = raw + 1
      pd.testing.assert_frame_equal(result, expected)
  
      raw_s = raw["col1"]
      series = from_pandas_series(raw_s, chunk_size=5)
  
      r = series.map_chunk(f1)
  
      result = r.execute().fetch()
      expected = raw_s + 1
      pd.testing.assert_series_equal(result, expected)
  
      def f2(pdf):
          return pdf.sum(axis=1)
  
      df = from_pandas_df(raw, chunk_size=5)
      r = df.map_chunk(f2, output_type="series")
  
      result = r.execute().fetch()
      expected = raw.sum(axis=1)
      pd.testing.assert_series_equal(result, expected)
  
      raw = pd.DataFrame(
          {"a": [f"s{i}" for i in range(10)], "b": np.arange(10)}
      )
  
      df = from_pandas_df(raw, chunk_size=5)
  
      def f3(pdf):
          return pdf["a"].str.slice(1).astype(int) + pdf["b"]
  
      with pytest.raises(TypeError):
          r = df.map_chunk(f3)
          _ = r.execute().fetch()
  
      r = df.map_chunk(
          f3, output_type="series", dtypes=pd.Series([np.int64])
      )
      result = r.execute(extra_config={"check_dtypes": False}).fetch()
      expected = f3(raw)
      pd.testing.assert_series_equal(result, expected)
  
      def f4(pdf):
          ret = pd.DataFrame(columns=["a", "b"])
          ret["a"] = pdf["a"].str.slice(1).astype(int)
          ret["b"] = pdf["b"]
          return ret
  
      with pytest.raises(TypeError):
          r = df.map_chunk(f4, output_type="dataframe")
          _ = r.execute().fetch()
  
      r = df.map_chunk(
          f4,
          output_type="dataframe",
          dtypes=pd.Series(
              [np.dtype(int), raw["b"].dtype], index=["a", "b"]
          ),
      )
      result = r.execute().fetch()
      expected = f4(raw)
      pd.testing.assert_frame_equal(result, expected)
  
      raw2 = pd.DataFrame(
          {"a": [np.array([1, 2, 3]), np.array([4, 5, 6])]}
      )
      df2 = from_pandas_df(raw2)
      dtypes = pd.Series([np.dtype(float)] * 3)
      r = df2.map_chunk(
          lambda x: x["a"].apply(pd.Series),
          output_type="dataframe",
          dtypes=dtypes,
      )
      assert r.shape == (np.nan, 3)
      pd.testing.assert_series_equal(r.dtypes, dtypes)
      result = r.execute().fetch()
      expected = raw2.apply(
          lambda x: x["a"], axis=1, result_type="expand"
      )
      pd.testing.assert_frame_equal(result, expected)
  
      raw = pd.DataFrame(
          np.random.rand(10, 5), columns=[f"col{i}" for i in range(5)]
      )
  
      df = from_pandas_df(raw, chunk_size=(5, 3))
  
      def f5(pdf, chunk_index):
          return pdf + 1 + chunk_index[0]
  
      r = df.map_chunk(f5, with_chunk_index=True)
  
      result = r.execute().fetch()
      expected = (raw + 1).add(np.arange(10) // 5, axis=0)
      pd.testing.assert_frame_equal(result, expected)
  
      raw_s = raw["col1"]
      series = from_pandas_series(raw_s, chunk_size=5)
  
      r = series.map_chunk(f5, with_chunk_index=True)
  
      result = r.execute().fetch()
      expected = raw_s + 1 + np.arange(10) // 5
      pd.testing.assert_series_equal(result, expected)
  
      # test args or kwargs with mars objects
      df = from_pandas_df(raw, chunk_size=5)
  
      def f6(df, mars_df):
          return df + mars_df.sum()
  
      df_arg = from_pandas_df(raw, chunk_size=6)
      r = df.map_chunk(
          f6, args=(df_arg,), output_type="dataframe", dtypes=df.dtypes
      )
      expected = raw + raw.sum()
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(result, expected)
  
      df = from_pandas_df(raw, chunk_size=5)
      df_arg = from_pandas_df(raw, chunk_size=6)
      r = df.map_chunk(
          f6,
          kwargs=dict(mars_df=df_arg),
          output_type="dataframe",
          dtypes=df.dtypes,
      )
      expected = raw + raw.sum()
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(result, expected)
  
      def f7(s):
          return s.to_json()
  
      with pytest.raises(TypeError):
          series.map_chunk(f7)
  
imports: import random
  from collections import OrderedDict
  import numpy
  import pandas
  import pytest
  import mars
  from ....config import options, option_context
  from ....dataframe import DataFrame, Series
  from ....tensor import arange, tensor
  from ....tensor.random import rand
  from ....tests.core import require_cudf
  from ....utils import lazy_import, pd_release_version, no_default
  from ...None import eval, cut, qcut, get_dummies
  from ...core import DATAFRAME_OR_SERIES_TYPE
  from ...datasource.dataframe import from_pandas
  from ...datasource.series import from_pandas
  from ...datasource.index import from_pandas
  from ..None import to_gpu, to_cpu
  from ..bloom_filter import filter_by_bloom_filter
  from ..shift import _enable_no_default, _with_column_freq_bug
  from ..to_numeric import to_numeric
  from ..rebalance import DataFrameRebalance
label_desc: Use image node_id 34 for calling a global function with example usage: test_map_chunk_execution(setup) and returns: unknown, pdf, unknown, ret, unknown, unknown, s