想要这样做,但反过来。
我date的 s 是这种格式YYYY-MM-DDThh:mm:ss,我想要两列YYYY-MM-DD,hh:mm如果我愿意,我可以连接某些查询。
使用时出现错误convert();我认为 Spark SQL 目前不支持此功能。
当我使用date(datetime)ortimestamp(datetime)时,我会返回所有空值。然而,minute(datetime)和hour(datetime)工作。
目前,使用这个
concat(date,' ', hour,':', (case when minute < 10 then concat('0',minute) else minute end)) as DateTime
from (select OtherDateOnlyColumn as date, minute(datetime) as minute, hour(datetime) as hour from ...)
这显然效率不高。