code: def get_feature_cols(
      df: DataFrame,
      transformer: Union[Transformer, PipelineModel],
  ) -> Set[str]:
      """
      Finds feature columns from an input dataset. If a dataset
      contains non-feature columns, those columns are not returned, but
      if `input_fields` is set to include non-feature columns those
      will be included in the return set of column names.
  
      :param df: An input spark dataframe.
      :param transformer: A pipeline/transformer to get the required feature columns
      :return: A set of all the feature columns that are required
               for the pipeline/transformer plus any initial columns passed in.
      """
      feature_cols = set()
      df_subset = df.limit(1).cache()
      for column in df.columns:
          try:
              transformer.transform(df_subset.drop(column))
          except IllegalArgumentException as iae:
              if re.search("does not exist", str(iae), re.IGNORECASE):
                  feature_cols.add(column)
                  continue
              raise
      df_subset.unpersist()
      return feature_cols
  
file_path: mlflow/mlflow/pyspark/ml/_autolog.py
imports: import re
  from functools import reduce
  from typing import Set, Union
  from pyspark.ml.base import Transformer
  from pyspark.ml.functions import vector_to_array
  from pyspark.ml.linalg import VectorUDT
  from pyspark.ml.pipeline import PipelineModel
  from pyspark.sql import DataFrame
  from pyspark.sql import types
label_desc: Use image node_id 4 for calling a global function with example usage: get_feature_cols(df, transformer) and returns: feature_cols