code: def _generate_column(column_params, num_rows):
      # If cardinality is specified, we create a set to sample from.
      # Otherwise, we simply use the given generator to generate each value.
  
      if column_params.cardinality is not None:
          # Construct set of values to sample from where
          # set size = cardinality
  
          if (
              isinstance(column_params.dtype, str)
              and column_params.dtype == "category"
          ):
              vals = pa.array(
                  column_params.generator,
                  size=column_params.cardinality,
                  safe=False,
              )
              return pa.DictionaryArray.from_arrays(
                  dictionary=vals,
                  indices=np.random.randint(
                      low=0, high=len(vals), size=num_rows
                  ),
                  mask=np.random.choice(
                      [True, False],
                      size=num_rows,
                      p=[
                          column_params.null_frequency,
                          1 - column_params.null_frequency,
                      ],
                  )
                  if column_params.null_frequency > 0.0
                  else None,
              )
  
          if hasattr(column_params.dtype, "to_arrow"):
              arrow_type = column_params.dtype.to_arrow()
          elif column_params.dtype is not None:
              arrow_type = np_to_pa_dtype(
                  cudf.dtype(column_params.dtype)
              )
          else:
              arrow_type = None
  
          if isinstance(column_params.dtype, cudf.StructDtype):
              vals = pa.StructArray.from_arrays(
                  column_params.generator,
                  names=column_params.dtype.fields.keys(),
                  mask=pa.array(
                      np.random.choice(
                          [True, False],
                          size=num_rows,
                          p=[
                              column_params.null_frequency,
                              1 - column_params.null_frequency,
                          ],
                      )
                  )
                  if column_params.null_frequency > 0.0
                  else None,
              )
              return vals
          elif not isinstance(arrow_type, pa.lib.Decimal128Type):
              vals = pa.array(
                  column_params.generator,
                  size=column_params.cardinality,
                  safe=False,
                  type=arrow_type,
              )
          vals = pa.array(
              np.random.choice(column_params.generator, size=num_rows)
              if isinstance(arrow_type, pa.lib.Decimal128Type)
              else np.random.choice(vals, size=num_rows),
              mask=np.random.choice(
                  [True, False],
                  size=num_rows,
                  p=[
                      column_params.null_frequency,
                      1 - column_params.null_frequency,
                  ],
              )
              if column_params.null_frequency > 0.0
              else None,
              size=num_rows,
              safe=False,
              type=None
              if isinstance(arrow_type, pa.lib.Decimal128Type)
              else arrow_type,
          )
          if isinstance(arrow_type, pa.lib.Decimal128Type):
              vals = vals.cast(arrow_type, safe=False)
          return vals
      else:
          # Generate data for current column
          return pa.array(
              column_params.generator,
              mask=np.random.choice(
                  [True, False],
                  size=num_rows,
                  p=[
                      column_params.null_frequency,
                      1 - column_params.null_frequency,
                  ],
              )
              if column_params.null_frequency > 0.0
              else None,
              size=num_rows,
              safe=False,
          )
  
imports: import copy
  import random
  import string
  import uuid
  from multiprocessing import Pool
  import numpy
  import pandas
  import pyarrow
  from pyarrow import parquet
  import cudf
  from cudf.utils.dtypes import np_to_pa_dtype
label_desc: Use image node_id 2 for calling a global function with example usage: _generate_column(column_params, num_rows) and returns: vals, pa, pa, vals