Hive秒数转成时分秒
问题:开发当中遇到秒数转成时分秒的情况
例如:1111秒 ==》 00:18:31
1.参考:在mysql中可以使用SEC_TO_TIME
2.套用到hive,没有SEC_TO_TIME函数
3.解决方案:使用多个函数进行拼接
SELECT concat_ws(':',
if(length(cast(floor(1111/3600) as string)) = 1,concat('0',cast(floor(1111/3600) as string)),cast(floor(1111/3600) as string))
,if(length(cast(floor(1111%3600/60) as string)) = 1,concat('0',cast(floor(1111%3600/60) as string)),cast(floor(1111%3600/60) as string))
,if(length(ca