如何使用Spark-Scala连接日期和时间列(两个字符串)
+---+-------------------+-----+
| ID| Date |Time
+---+------------------ +-----+
| G|2014.01.14 00:00:00| 1:00
+---+-------------------+------
"2014.01.14 1:00"
答案 0 :(得分:1)
尝试一下,
result.withColumn("Date && Time", concat(regexp_replace(col("date"),"00:00:00",""), lit(""), (col("time"))))
答案 1 :(得分:0)
您可以使用:
result.withColumn("Date && Time", concat(col("Date"), lit(""), (col("Time")) ));