code: def test_read_csv_execution(setup, setup_hdfs):
      hdfs = setup_hdfs
  
      with hdfs.open(
          f"{TEST_DIR}/simple_test.csv", "wb", replication=1
      ) as f:
          f.write(b"name,amount,id\nAlice,100,1\nBob,200,2")
  
      df = md.read_csv(
          f"hdfs://localhost:8020{TEST_DIR}/simple_test.csv"
      )
      expected = pd.read_csv(
          BytesIO(b"name,amount,id\nAlice,100,1\nBob,200,2")
      )
      res = df.to_pandas()
      pd.testing.assert_frame_equal(expected, res)
  
      test_df = pd.DataFrame(
          {
              "A": np.random.rand(20),
              "B": [
                  pd.Timestamp("2020-01-01")
                  + pd.Timedelta(days=random.randint(0, 31))
                  for _ in range(20)
              ],
              "C": np.random.rand(20),
              "D": np.random.randint(0, 100, size=(20,)),
              "E": [
                  "foo" + str(random.randint(0, 999999))
                  for _ in range(20)
              ],
          }
      )
      buf = StringIO()
      test_df[:10].to_csv(buf)
      csv_content = buf.getvalue().encode()
  
      buf = StringIO()
      test_df[10:].to_csv(buf)
      csv_content2 = buf.getvalue().encode()
  
      with hdfs.open(
          f"{TEST_DIR}/chunk_test.csv", "wb", replication=1
      ) as f:
          f.write(csv_content)
  
      df = md.read_csv(
          f"hdfs://localhost:8020{TEST_DIR}/chunk_test.csv",
          chunk_bytes=50,
      )
      expected = pd.read_csv(BytesIO(csv_content))
      res = df.to_pandas()
      pd.testing.assert_frame_equal(
          expected.reset_index(drop=True), res.reset_index(drop=True)
      )
  
      test_read_dir = f"{TEST_DIR}/test_read_csv_directory"
      hdfs.mkdir(test_read_dir)
      with hdfs.open(
          f"{test_read_dir}/part.csv", "wb", replication=1
      ) as f:
          f.write(csv_content)
      with hdfs.open(
          f"{test_read_dir}/part2.csv", "wb", replication=1
      ) as f:
          f.write(csv_content2)
  
      df = md.read_csv(
          f"hdfs://localhost:8020{test_read_dir}", chunk_bytes=50
      )
      expected = pd.concat(
          [
              pd.read_csv(BytesIO(csv_content)),
              pd.read_csv(BytesIO(csv_content2)),
          ]
      )
      res = df.to_pandas()
      pd.testing.assert_frame_equal(
          expected.reset_index(drop=True), res.reset_index(drop=True)
      )
  
file_path: mars/mars/dataframe/datasource/tests/test_datasource_hdfs.py
imports: import random
  from io import BytesIO, StringIO
  import pandas
  import numpy
  import pytest
  from ....None import dataframe
  from ....tests.core import require_hadoop
label_desc: Use image node_id 2 for calling a global function with example usage: test_read_csv_execution(setup, setup_hdfs) without return types