Hive中计算两时间字段间隔小时数的方法

在hive中计算两时间字段的方法,不像Oracle中那么方便,需要经过如下示例所示的转换:

select room_id,switch_time,updated_time,(hour(updated_time)-hour(switch_time)+(datediff(updated_time,switch_time))*24) as hourIntervals
from oss_bi_all_live_history_status
where pt_day='2018-12-01'
limit 100;

 

    原文作者:BabyFish13
    原文地址: https://blog.csdn.net/BabyFish13/article/details/87917874
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞