code: def test_apply_ensure_data(setup):
      df = pd.DataFrame({"c1": [1, 2, 3, 4], "c2": [5, 6, 7, 8]})
      mdf = md.DataFrame(df, chunk_size=3)
      apply_func = np.sqrt
  
      r = mdf.apply(apply_func, output_type="df_or_series")
      res = r.ensure_data()
      assert isinstance(res, DataFrame)
      assert isinstance(res.op, DataFrameFetch)
      pd.testing.assert_frame_equal(
          res.execute().fetch(), df.apply(apply_func)
      )
      pd.testing.assert_frame_equal(
          (res + 1).execute().fetch(), df.apply(apply_func) + 1
      )
      pd.testing.assert_frame_equal(
          (res * 3).execute().fetch(), df.apply(apply_func) * 3
      )
  
      r = res.groupby("c1").max()
      expected = df.apply(apply_func).groupby("c1").max()
      pd.testing.assert_frame_equal(r.execute().fetch(), expected)
  
      apply_func = np.mean
      res = mdf.apply(
          apply_func, output_type="df_or_series", axis=1
      ).ensure_data()
      expected = df.apply(apply_func, axis=1)
      pd.testing.assert_series_equal(res.execute().fetch(), expected)
  
      res = (
          res.to_frame(name="foo")
          .groupby("foo")[["foo"]]
          .max()
          .execute()
      )
      expected = (
          expected.to_frame(name="foo").groupby("foo")[["foo"]].max()
      )
      pd.testing.assert_frame_equal(res.fetch(), expected)
  
file_path: mars/mars/dataframe/base/tests/test_apply_execution.py
imports: import numpy
  import pandas
  import pytest
  from ....None import dataframe
  from ....dataframe.core import DataFrame, DATAFRAME_OR_SERIES_TYPE
  from ....dataframe.fetch.core import DataFrameFetch
label_desc: Use image node_id 5 for calling a global function with example usage: test_apply_ensure_data(setup) without return types