code: def setup_hdfs():
      import pyarrow
  
      hdfs = pyarrow.hdfs.connect(host="localhost", port=8020)
      if hdfs.exists(TEST_DIR):
          hdfs.rm(TEST_DIR, recursive=True)
      try:
          yield hdfs
      finally:
          if hdfs.exists(TEST_DIR):
              hdfs.rm(TEST_DIR, recursive=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 1 for calling a global function with example usage: setup_hdfs() without return types