, если дата в строковом формате -
select datediff(
(from_unixtime(unix_timestamp(enddate, dateformat), dateformat)) -
(from_unixtime(unix_timestamp(startdate, dateformat), dateformat)));
Ex - hive> select datediff(from_unixtime(unix_timestamp('2019-01-28', 'yyyy-MM-dd'), 'yyyy-MM-dd'), from_unixtime(unix_timestamp('2019-01-27', 'yyyy-MM-dd'), 'yyyy-MM-dd'));