code: def test_sample_execution(setup):
      rs = np.random.RandomState(0)
  
      # test dataframe
      raw_df = pd.DataFrame(
          rs.rand(100, 5), columns=["c1", "c2", "c3", "c4", "c5"]
      )
  
      # test single chunk
      df = md.DataFrame(raw_df)
      r = df.sample(10, random_state=rs)
      pd.testing.assert_frame_equal(
          r.execute().fetch(), raw_df.sample(10, random_state=rs)
      )
      r = df.sample(frac=0.1, weights="c1", random_state=rs)
      pd.testing.assert_frame_equal(
          r.execute().fetch(),
          raw_df.sample(frac=0.1, weights="c1", random_state=rs),
      )
      r = df.sample(10, weights=df["c2"], random_state=rs)
      pd.testing.assert_frame_equal(
          r.execute().fetch(),
          raw_df.sample(10, weights=raw_df["c2"], random_state=rs),
      )
  
      r = df.sample(10, weights=df["c2"], random_state=0)
      pd.testing.assert_frame_equal(
          r.execute().fetch(),
          raw_df.sample(10, weights=raw_df["c2"], random_state=0),
      )
  
      r = df.sample(10, weights=df["c2"], random_state=np.array([1, 2]))
      pd.testing.assert_frame_equal(
          r.execute().fetch(),
          raw_df.sample(
              10, weights=raw_df["c2"], random_state=np.array([1, 2])
          ),
      )
  
      # test multinomial tile & execution
      df = md.DataFrame(raw_df, chunk_size=13)
      r1 = df.sample(10, replace=True, random_state=rs)
      r2 = df[:].sample(10, replace=True, random_state=rs)
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(
          frac=0.1,
          weights="c2",
          always_multinomial=True,
          random_state=rs,
      )
      r2 = df[:].sample(
          frac=0.1,
          weights="c2",
          always_multinomial=True,
          random_state=rs,
      )
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(
          frac=0.1,
          weights=df["c2"],
          always_multinomial=True,
          random_state=rs,
      )
      r2 = df[:].sample(
          frac=0.1,
          weights=df["c2"],
          always_multinomial=True,
          random_state=rs,
      )
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(
          frac=0.1,
          weights=df["c2"],
          always_multinomial=True,
          random_state=0,
      )
      r2 = df[:].sample(
          frac=0.1,
          weights=df["c2"],
          always_multinomial=True,
          random_state=0,
      )
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(
          frac=0.1,
          weights=df["c2"],
          always_multinomial=True,
          random_state=np.array([1, 2]),
      )
      r2 = df[:].sample(
          frac=0.1,
          weights=df["c2"],
          always_multinomial=True,
          random_state=np.array([1, 2]),
      )
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      # test reservoir tile & execution
      df = md.DataFrame(raw_df, chunk_size=13)
      r1 = df.sample(90, random_state=rs)
      r2 = df[:].sample(90, random_state=rs)
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(10, random_state=rs)
      r2 = df[:].sample(10, random_state=rs)
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(frac=0.1, weights="c2", random_state=rs)
      r2 = df[:].sample(frac=0.1, weights="c2", random_state=rs)
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(frac=0.1, weights=df["c2"], random_state=rs)
      r2 = df[:].sample(frac=0.1, weights=df["c2"], random_state=rs)
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(frac=0.1, weights=df["c2"], random_state=0)
      r2 = df[:].sample(frac=0.1, weights=df["c2"], random_state=0)
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = df.sample(
          frac=0.1, weights=df["c2"], random_state=np.array([1, 2])
      )
      r2 = df[:].sample(
          frac=0.1, weights=df["c2"], random_state=np.array([1, 2])
      )
      pd.testing.assert_frame_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      # test series
      raw_series = pd.Series(rs.rand(100))
      raw_weights = pd.Series(rs.rand(100))
  
      # test single chunk
      s = md.Series(raw_series)
      r = s.sample(10, random_state=rs)
      pd.testing.assert_series_equal(
          r.execute().fetch(), raw_series.sample(10, random_state=rs)
      )
      weights = md.Series(raw_weights, chunk_size=13)
      r = s.sample(10, weights=weights, random_state=rs)
      pd.testing.assert_series_equal(
          r.execute().fetch(),
          raw_series.sample(10, weights=raw_weights, random_state=rs),
      )
  
      # test multinomial tile & execution
      s = md.Series(raw_series, chunk_size=13)
      weights = md.Series(raw_weights, chunk_size=13)
  
      r1 = s.sample(10, replace=True, random_state=rs)
      r2 = s[:].sample(10, replace=True, random_state=rs)
      pd.testing.assert_series_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = s.sample(
          frac=0.1,
          weights=weights,
          always_multinomial=True,
          random_state=rs,
      )
      r2 = s[:].sample(
          frac=0.1,
          weights=weights,
          always_multinomial=True,
          random_state=rs,
      )
      pd.testing.assert_series_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      # test reservoir tile & execution
      r1 = s.sample(10, random_state=rs)
      r2 = s[:].sample(10, random_state=rs)
      pd.testing.assert_series_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
      r1 = s.sample(frac=0.1, weights=weights, random_state=rs)
      r2 = s[:].sample(frac=0.1, weights=weights, random_state=rs)
      pd.testing.assert_series_equal(
          r1.execute().fetch(), r2.execute().fetch()
      )
  
imports: import os
  import tempfile
  import mars
  import numpy
  import pandas
  import pytest
  from ....None import dataframe
  from ....None import tensor
  from ....utils import pd_release_version
  from ...datasource.read_csv import DataFrameReadCSV
  from ...datasource.read_sql import DataFrameReadSQL
  from ...datasource.read_parquet import DataFrameReadParquet
label_desc: Use image node_id 26 for calling a global function with example usage: test_sample_execution(setup) without return types