class_docstr: API for generating data statistics.
  
  Example:
  
  ```python
    with beam.Pipeline(runner=...) as p:
      _ = (p
           | 'ReadData' >> tfx_bsl.public.tfxio.TFExampleRecord(data_location)
               .BeamSource()
           | 'GenerateStatistics' >> GenerateStatistics()
           | 'WriteStatsOutput' >> tfdv.WriteStatisticsToTFRecord(output_path))
  ```
class_docstr_tok: ["API","for","generating","data","statistics",".","Example",":","``","`","python","with","beam.Pipeline","(","runner=","...",")","as","p",":","_","=","(","p","|","'ReadData","'",">",">","tfx_bsl.public.tfxio.TFExampleRecord","(","data_location",")",".BeamSource","(",")","|","'GenerateStatistics","'",">",">","GenerateStatistics","(",")","|","'WriteStatsOutput","'",">",">","tfdv.WriteStatisticsToTFRecord","(","output_path",")",")","``","`"]
code: def expand(
      self, dataset: beam.PCollection[pa.RecordBatch]
  ) -> beam.PCollection[statistics_pb2.DatasetFeatureStatisticsList]:
      if self._options.sample_rate is not None:
          dataset |= (
              "SampleExamplesAtRate(%s)" % self._options.sample_rate
              >> beam.FlatMap(
                  _sample_at_rate, sample_rate=self._options.sample_rate
              )
          )
  
      return (
          dataset
          | "RunStatsGenerators"
          >> stats_impl.GenerateStatisticsImpl(self._options)
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import random
  from typing import Generator, Text, Optional
  import apache_beam
  import pyarrow
  from tensorflow_data_validation.utils import artifacts_io_impl
  from tensorflow_data_validation.statistics import stats_impl
  from tensorflow_data_validation.statistics import stats_options
  from tfx_bsl.statistics import merge_util
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 2 for calling the GenerateStatistics obj's underlying member method code with example usage: obj.expand(dataset) and returns: unknown