What is the best way to do a diff on timestamp fields in Impala version 1.2.3 where the difference in milliseconds is required?
Here is my query-
select a.session_key,a.ani,a.event_timestamp "event_start_timetsamp",b.event_timestamp "event_end_timestamp"
from nuance_ivr_logs a, nuance_ivr_logs b
where
a.session_key='{134E1EF7-3A8E-4FA8-A944-89367DEA8FB7}'
and a.session_key=b.session_key
and a.ani=b.ani
and a.event_type='SWIclst' and a.event_attribute_seq=1
and b.event_type='SWIclnd' and a.event_attribute_seq=1;
+----------------------------------------+------------+-------------------------------+-------------------------------+
| session_key | ani | event_start_timetsamp | event_end_timestamp |
+----------------------------------------+------------+-------------------------------+-------------------------------+
| {134E1EF7-3A8E-4FA8-A944-89367DEA8FB7} | xxxxxxxx | 2013-12-17 17:59:58.677000000 | 2013-12-17 18:02:51.239000000 |
+----------------------------------------+------------+-------------------------------+-------------------------------+
I need to add a column for event_duration, which is the diff of event_end_timestamp and event_start_timestamp.
Thanks.