Использование функций unix_timestamp и date_format
scala> val dt = Seq("2019-03-16T16:54:42.968Z").toDF("ts_str")
dt: org.apache.spark.sql.DataFrame = [ts_str: string]
scala> dt.select(unix_timestamp('ts_str,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")).show
+----------------------------------------------------+
|unix_timestamp(ts_str, yyyy-MM-dd'T'HH:mm:ss.SSS'Z')|
+----------------------------------------------------+
| 1552735482|
+----------------------------------------------------+
scala> dt.select(date_format(unix_timestamp('ts_str,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").cast("timestamp"), "yyyyMMddHHmm").as("res") ).show
+------------+
| res|
+------------+
|201903161654|
+------------+
scala>
или просто с помощью функций to_timestamp и date_format
scala> val dt = Seq("2019-03-16T16:54:42.968Z").toDF("ts_str")
dt: org.apache.spark.sql.DataFrame = [ts_str: string]
scala> dt.withColumn("ts_str",to_timestamp('ts_str,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")).show(false)
+-------------------+
|ts_str |
+-------------------+
|2019-03-16 16:54:42|
+-------------------+
scala> dt.withColumn("ts_str",date_format(to_timestamp('ts_str,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"), "yyyyMMddHHmm" )).show(false)
+------------+
|ts_str |
+------------+
|201903161654|
+------------+
scala>