code: def test_stats_pipeline(self):
      record_batches = [
          pa.RecordBatch.from_arrays(
              [
                  pa.array([[1.0, 2.0]]),
                  pa.array([["a", "b", "c", "d"]]),
                  pa.array([np.linspace(1, 500, 500, dtype=np.int32)]),
              ],
              ["a", "b", "c"],
          ),
          pa.RecordBatch.from_arrays(
              [
                  pa.array([[3.0, 4.0, np.NaN, 5.0]]),
                  pa.array([["a", "c", "∞", "a"]]),
                  pa.array(
                      [np.linspace(501, 1250, 750, dtype=np.int32)]
                  ),
              ],
              ["a", "b", "c"],
          ),
          pa.RecordBatch.from_arrays(
              [
                  pa.array([[1.0]]),
                  pa.array([["a", "b", "c", "∞"]]),
                  pa.array(
                      [np.linspace(1251, 3000, 1750, dtype=np.int32)]
                  ),
              ],
              ["a", "b", "c"],
          ),
      ]
  
      expected_result = text_format.Parse(
          """
      datasets {
        num_examples: 3
        features {
          path {
            step: 'a'
          }
          type: FLOAT
          num_stats {
            common_stats {
              num_non_missing: 3
              num_missing: 0
              min_num_values: 1
              max_num_values: 4
              avg_num_values: 2.33333333
              tot_num_values: 7
            }
            mean: 2.66666666
            std_dev: 1.49071198
            num_zeros: 0
            min: 1.0
            max: 5.0
            median: 3.0
          }
        }
        features {
          path {
            step: 'c'
          }
          type: INT
          num_stats {
            common_stats {
              num_non_missing: 3
              num_missing: 0
              min_num_values: 500
              max_num_values: 1750
              avg_num_values: 1000.0
              tot_num_values: 3000
            }
            mean: 1500.5
            std_dev: 866.025355672
            min: 1.0
            max: 3000.0
            median: 1501.0
          }
        }
        features {
          path {
            step: 'b'
          }
          type: STRING
          string_stats {
            common_stats {
              num_non_missing: 3
              min_num_values: 4
              max_num_values: 4
              avg_num_values: 4.0
              tot_num_values: 12
            }
            unique: 5
            top_values {
              value: "a"
              frequency: 4.0
            }
            top_values {
              value: "c"
              frequency: 3.0
            }
            avg_length: 1.333333
            rank_histogram {
              buckets {
                low_rank: 0
                high_rank: 0
                label: "a"
                sample_count: 4.0
              }
              buckets {
                low_rank: 1
                high_rank: 1
                label: "c"
                sample_count: 3.0
              }
              buckets {
                low_rank: 2
                high_rank: 2
                label: "∞"
                sample_count: 2.0
              }
            }
          }
        }
      }
      """,
          statistics_pb2.DatasetFeatureStatisticsList(),
      )
  
      with beam.Pipeline() as p:
          options = stats_options.StatsOptions(
              num_top_values=2,
              num_rank_histogram_buckets=3,
              num_values_histogram_buckets=3,
              num_histogram_buckets=3,
              num_quantiles_histogram_buckets=4,
              epsilon=0.001,
          )
          result = (
              p
              | beam.Create(record_batches)
              | stats_api.GenerateStatistics(options)
          )
          util.assert_that(
              result,
              test_util.make_dataset_feature_stats_list_proto_equal_fn(
                  self, expected_result, check_histograms=False
              ),
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tempfile
  from absl.testing import absltest
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_data_validation.api import stats_api
  from tensorflow_data_validation.utils import artifacts_io_impl
  from tensorflow_data_validation.statistics import stats_options
  from tensorflow_data_validation.utils import io_util
  from tensorflow_data_validation.utils import stats_util
  from tensorflow_data_validation.utils import test_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 2 for calling the StatsAPITest obj's underlying member method code with example usage: obj.test_stats_pipeline() without return types