Compute differences between succesive records in Hadoop with Hive Queries
It's an old question, but for future references, I write here another proposition:
Hive Windowing functions allows to use previous / next values in your query.
A similar code query may be :
SELECT customer_id, call_time - LAG(call_time, 1, 0) OVER (PARTITION BY customer_id ORDER BY call_time) FROM mytable;