I do not see an Impala function to subtract two datestamps
and return seconds (or minutes) between the two.
http://www.cloudera.com/documentation/archive/impala/2-x/2-0-x/topics/impala_datetime_functions.html
Discussion: If you'd like to calculate the difference between the timestamps in seconds, multiply the decimal difference in days by the number of seconds in a day, which equals 24 * 60 * 60 = 86400 , or the product of the number of hours in a day, the number of minutes in an hour, and the number of seconds in a minute.
Because Impala implicitly converts string values into TIMESTAMP , you can pass date/time values represented as strings (in the standard yyyy-MM-dd HH:mm:ss. SSS format) to this function.
from_timestamp(timestamp_data, 'yyyyMMdd') - This converts a date to a desired string format. -interval 2 days - This takes date time back to 2days before system date.
unix_timestamp(finish_time)-unix_timestamp(start_time) will give you the seconds between them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With