在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;