Я на самом деле нашел три способа сделать это:
.withColumn("new_col_name", (col("date_col_oftypeString").cast("date")))
.withColumn("new_col_name",lit($"date_col_oftypeString").cast(DateType))
.withColumn("new_col_name", to_date(unix_timestamp($"date_col_oftypeString", "yyyy-MM-dd").cast("timestamp")))
Не забудьте импортировать:
import org.apache.spark.sql.functions._
import org.apache.spark.sql.types.{DateType}
import java.sql.Timestamp
import java.util._
import spark.implicits._