class_docstr: Breaks a DatasetFeatureStatisticsList into shards keyed by partition index.
  
  Each partition index contains a random (but deterministic across workers)
  subset of features and cross features.
class_docstr_tok: ["Breaks","a","DatasetFeatureStatisticsList","into","shards","keyed","by","partition","index",".","Each","partition","index","contains","a","random","(","but","deterministic","across","workers",")","subset","of","features","and","cross","features","."]
code: def process(
      self, statistics: statistics_pb2.DatasetFeatureStatisticsList
  ):
      # If the number of partitions is one, or there are no datasets, yield the
      # full statistics proto with a placeholder key.
      if self._hasher is None or not statistics.datasets:
          yield (0, statistics)
          return
      for dataset in statistics.datasets:
          for feature in dataset.features:
              if feature.name:
                  partition = self._hasher.assign_sequence(
                      dataset.name, feature.name
                  )
              else:
                  partition = self._hasher.assign_sequence(
                      dataset.name, *feature.path.step
                  )
              dataset_copy = _copy_with_no_features(dataset)
              dataset_copy.features.append(feature)
              yield (
                  partition,
                  statistics_pb2.DatasetFeatureStatisticsList(
                      datasets=[dataset_copy]
                  ),
              )
          for cross_feature in dataset.cross_features:
              partition = self._hasher.assign_sequence(
                  dataset.name,
                  *cross_feature.path_x.step,
                  *cross_feature.path_y.step,
              )
              dataset_copy = _copy_with_no_features(dataset)
              dataset_copy.cross_features.append(cross_feature)
              yield (
                  partition,
                  statistics_pb2.DatasetFeatureStatisticsList(
                      datasets=[dataset_copy]
                  ),
              )
          # If there were no features or cross-features, yield the dataset itself
          # into shard 0 to ensure it's not dropped entirely.
          if not dataset.features and not dataset.cross_features:
              yield (
                  0,
                  statistics_pb2.DatasetFeatureStatisticsList(
                      datasets=[dataset]
                  ),
              )
  
file_path: data-validation/tensorflow_data_validation/utils/feature_partition_util.py
imports: import collections
  from typing import Any, FrozenSet, Iterable, Mapping, Tuple, Union
  import apache_beam
  import farmhash
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 2 for calling the KeyAndSplitByFeatureFn obj's underlying member method code with example usage: obj.process(statistics) without return types