title: Pyspark: How to convert array of strings in a dataframe to array of timestamps
body: <p>I run a simple query to get cookie as string and timestamps as array using pyspark sql. 
  I want to pass them to my user defined function but the array of timestamps is passed as an array of unicodes.
  Can someone help me figure this out. Thanks</p>
  
  <pre><code>@udf(returnType=StringType())
  def PrintDetails(cookie, timestamps, current_day, current_hourly_threshold,current_daily_threshold):
      print(type(timestamps[0]))
  def main(argv):
      spark = SparkSession \
          .builder \
          .appName("parquet_test") \
          .config("spark.debug.maxToStringFields", "100") \
          .getOrCreate()
  
      inputPath = r'D:\Hadoop\Spark\parquet_input_files'
      inputFiles = os.path.join(inputPath, '*.parquet')
  
      impressionDate =  datetime.strptime("2019_12_31", '%Y_%m_%d')
      current_hourly_threshold = 40
      current_daily_threshold = 200
  
      parquetFile = spark.read.parquet(inputFiles)
      parquetFile.createOrReplaceTempView("parquetFile")
      cookie_and_time = spark.sql("SELECT cookie, collect_list(date_format(from_unixtime(ts), 'YYYY-MM-dd-hh:mm:ss'))  as imp_times FROM parquetFile group by 1  ")
  
      cookie_df = cookie_and_time.withColumn("cookies", PrintDetails(cookie_and_time['cookie'], cookie_and_time['imp_times'], lit(impressionDate), lit(current_hourly_threshold), lit(current_daily_threshold)))
      cookie_df.show()
  
  if __name__ == "__main__":
      main(sys.argv)
  
  </code></pre>