code: def build_iterator_over_one_table(
      table: pa.Table,
      order_by_length: Optional[str] = None,
      batch_size: Optional[int] = None,
      max_tokens: Optional[int] = None,
      shuffle: bool = True,
      seed: Optional[int] = None,
      num_parallel_calls: int = 8,
  ) -> DataPipeline:
      random_state = np.random.RandomState(seed)
      if order_by_length is not None:
          length_col = compute_rows_length(table[order_by_length])
          # add small perturbation to avoid same sample appear together during different epochs
          if shuffle:
              perturbation = random_state.randint(
                  0,
                  np.quantile(length_col, 0.001).astype(np.int32) + 2,
                  len(length_col),
              )
              length_col += np.asarray(perturbation, dtype=np.int32)
      else:
          if shuffle:
              length_col = random_state.randint(0, 2**23, len(table))
          else:
              length_col = np.zeros(len(table), dtype=np.int32)
  
      if batch_size is not None:
          order_tt = pa.Table.from_arrays(
              [pa.array(np.argsort(length_col, kind="stable"))],
              ["order"],
          )
          batches = [
              ind["order"] for ind in order_tt.to_batches(batch_size)
          ]
      elif max_tokens is not None:
          batches = compute_length_splits(length_col, max_tokens)
      else:
          raise ValueError("unknown batching method")
  
      if shuffle:
          batches = [
              batches[i] for i in random_state.permutation(len(batches))
          ]
  
      return (
          read_sequence(batches)
          .map(
              table_func_wrap(
                  lambda ind: table.take(ind).combine_chunks()
              ),
              num_parallel_calls=num_parallel_calls,
          )
          .and_return(max_num_warnings=4)
      )
  
imports: from contextlib import contextmanager
  from typing import Dict, Generator, List, Optional, Union
  import numpy
  import pandas
  import pyarrow
  import pyarrow.parquet
  import torch
  from numpy.typing import NDArray
  from pyarrow.dataset import get_partition_keys
  from fairseq2.data import CString
  from fairseq2.data.data_pipeline import DataPipeline, DataPipelineBuilder, read_sequence
label_desc: Use image node_id 17 for calling a global function with example usage: build_iterator_over_one_table(table, order_by_length, batch_size, max_tokens, shuffle, seed, num_parallel_calls) and returns: read_sequence