code: def test_bulk_sampler_io_empty_batch(scratch_dir):
      sources_array = [
          0,
          0,
          1,
          2,
          2,
          2,
          3,
          4,
          5,
          5,
          6,
          7,
          9,
          9,
          12,
          13,
          29,
          29,
          31,
          14,
      ]
  
      destinations_array = [
          1,
          2,
          3,
          3,
          3,
          4,
          1,
          1,
          6,
          7,
          2,
          3,
          12,
          13,
          18,
          19,
          31,
          14,
          15,
          16,
      ]
  
      hops_array = [
          0,
          0,
          1,
          1,
          0,
          0,
          1,
          1,
          0,
          0,
          1,
          1,
          0,
          0,
          1,
          1,
          0,
          0,
          1,
          1,
      ]
  
      results = cudf.DataFrame(
          {
              "sources": sources_array,
              "destinations": destinations_array,
              "edge_id": None,
              "edge_type": None,
              "weight": None,
              "hop_id": hops_array,
          }
      )
  
      assert len(results) == 20
  
      # some batches are missing
      offsets = cudf.DataFrame(
          {
              "offsets": [0, 8, 12, 16, 20],
              "batch_id": [0, 3, 4, 10, None],
          }
      )
  
      samples_path = os.path.join(
          scratch_dir, "test_bulk_sampler_io_empty_batch"
      )
      create_directory_with_overwrite(samples_path)
  
      write_samples(results, offsets, None, 2, samples_path)
  
      files = os.listdir(samples_path)
      assert len(files) == 2
  
      df0 = cudf.read_parquet(
          os.path.join(samples_path, "batch=0-1.parquet")
      )
  
      assert df0.batch_id.min() == 0
      assert df0.batch_id.max() == 1
  
      df1 = cudf.read_parquet(
          os.path.join(samples_path, "batch=4-5.parquet")
      )
      assert df1.batch_id.min() == 4
      assert df1.batch_id.max() == 5
  
      shutil.rmtree(samples_path)
  
file_path: cugraph/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io.py
imports: import os
  import shutil
  import pytest
  import cupy
  import cudf
  from cugraph.gnn.data_loading.bulk_sampler_io import write_samples
  from cugraph.utilities.utils import create_directory_with_overwrite
label_desc: Use image node_id 2 for calling a global function with example usage: test_bulk_sampler_io_empty_batch(scratch_dir) without return types