apache pig - Finding the difference between start_times and end_times in PIG -


could please tell me how find difference between 2 times in pig...

for e.g., below sample start_times , end_times, need find difference between start_time , end_time in pig.

12:31:38,14:54:04 10:18:34,13:30:56 13:37:43,15:18:57 08:15:10,11:28:17 

thanks in advance...

couldn't find straightforward way. here workaround:

    t = load ' input/data' using pigstorage(',') (time1:chararray,time2:chararray);     u = foreach t generate secondsbetween(todate(time2,'hh:mm:ss'),todate(time1,'hh:mm:ss')) seconds;     v = foreach u generate seconds/3600 hours,(seconds%3600)/60 minutes,(seconds%3600)%60 seconds;     store v 'output/data' using pigstorage(':'); 

output sample data code:

    2:22:26     3:12:22     1:41:14     3:13:7 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -