code: def select_relevant_columns(
      df,
      discrete_action: bool = True,
      include_possible_actions: bool = True,
  ):
      """Select all the relevant columns and perform type conversions."""
      if not discrete_action and include_possible_actions:
          raise NotImplementedError(
              "currently we don't support include_possible_actions"
          )
  
      select_col_list = [
          col("reward").cast(FloatType()),
          col("state_features").cast(ArrayType(FloatType())),
          col("state_features_presence").cast(ArrayType(BooleanType())),
          col("next_state_features").cast(ArrayType(FloatType())),
          col("next_state_features_presence").cast(
              ArrayType(BooleanType())
          ),
          col("not_terminal").cast(BooleanType()),
          col("action_probability").cast(FloatType()),
          col("mdp_id").cast(LongType()),
          col("sequence_number").cast(LongType()),
          col("step").cast(LongType()),
          col("time_diff").cast(LongType()),
          col("metrics").cast(ArrayType(FloatType())),
          col("metrics_presence").cast(ArrayType(BooleanType())),
      ]
  
      if discrete_action:
          select_col_list += [
              col("action").cast(LongType()),
              col("next_action").cast(LongType()),
          ]
      else:
          select_col_list += [
              col("action").cast(ArrayType(FloatType())),
              col("next_action").cast(ArrayType(FloatType())),
              col("action_presence").cast(ArrayType(BooleanType())),
              col("next_action_presence").cast(
                  ArrayType(BooleanType())
              ),
          ]
  
      if include_possible_actions:
          select_col_list += [
              col("possible_actions_mask").cast(ArrayType(LongType())),
              col("possible_next_actions_mask").cast(
                  ArrayType(LongType())
              ),
          ]
  
      return df.select(*select_col_list)
  
imports: import logging
  from typing import List, Optional, Tuple
  from pyspark.sql.functions import col, crc32, explode, map_keys, udf
  from pyspark.sql.types import ArrayType, BooleanType, FloatType, LongType, MapType, StructField, StructType
  from reagent.data.data_fetcher import DataFetcher
  from reagent.data.spark_utils import get_spark_session, get_table_url
  from reagent.workflow.types import Dataset, TableSpec
label_desc: Use image node_id 14 for calling a global function with example usage: select_relevant_columns(df, discrete_action, include_possible_actions) and returns: df