<div class=”post-text”>
I am processing the files that contains the call details of different users. In the data file, there is a field call_duration
which contains the value in the format hh:mm:ss
. eg: 00:49:39
, 00:20:00
etc
I would like to calculate the the total call duration of each user per month.
I do not see a data type in hive which can stock the time format in hh:mm:ss
. ( Currently I have this data as string in my staging table).
I am thinking of writing a UDF which converts the time into seconds, so that i can do a sum(call_duration
) grouping by user.
Did any one face a similar situation? Should I go with writing a UDF for is there a better approach?
Thanks a lot in advance
</div>