code: def _split_row_groups(dataset):
      if not dataset.metadata or dataset.metadata.num_row_groups == 0:
          raise NotImplementedError(
              "split_row_groups is only implemented "
              "if dataset has parquet summary files "
              "with row group information"
          )
  
      # We make a dictionary of how many row groups are in each file in
      # order to split them. The Parquet Metadata file stores paths as the
      # relative path from the dataset base dir.
      row_groups_per_file = dict()
      for i in range(dataset.metadata.num_row_groups):
          row_group = dataset.metadata.row_group(i)
          path = row_group.column(0).file_path
          row_groups_per_file[path] = (
              row_groups_per_file.get(path, 0) + 1
          )
  
      base_path = os.path.normpath(
          os.path.dirname(dataset.metadata_path)
      )
      split_pieces = []
      for piece in dataset.pieces:
          # Since the pieces are absolute path, we get the
          # relative path to the dataset base dir to fetch the
          # number of row groups in the file
          relative_path = os.path.relpath(piece.path, base_path)
  
          # If the path is not in the metadata file, that means there are
          # no row groups in that file and that file should be skipped
          if relative_path not in row_groups_per_file:
              continue
  
          for row_group in range(row_groups_per_file[relative_path]):
              split_piece = pq.ParquetDatasetPiece(
                  piece.path,
                  open_file_func=dataset.fs.open,
                  row_group=row_group,
                  partition_keys=piece.partition_keys,
              )
              split_pieces.append(split_piece)
  
      return split_pieces
  
imports: import json
  import logging
  import os
  from concurrent import futures
  from contextlib import contextmanager
  from operator import attrgetter
  from urllib.parse import urlparse
  from packaging import version
  from pyarrow import parquet
  from six.moves import cPickle
  from petastorm import utils
  from petastorm.etl.legacy import depickle_legacy_package_name_compatible
  from petastorm.fs_utils import FilesystemResolver, get_filesystem_and_path_or_paths, get_dataset_path
  from petastorm.unischema import Unischema
label_desc: Use image node_id 7 for calling a global function with example usage: _split_row_groups(dataset) and returns: split_pieces