Assuming data is the alias which has start_time and end_time as fields.

data2 = foreach data generate ToDate(Start_time, 'HH:mm:ss') as startDate,
ToDate(End_time, 'HH:mm:ss') as endDate;
data3 = foreach data2 generate SecondsBetween(endDate,startDate) as seconds;

You can find more such functions at
https://github.com/apache/pig/tree/trunk/src/org/apache/pig/builtin




On Fri, Jun 27, 2014 at 4:07 PM, Chhaya Vishwakarma <
[email protected]> wrote:

> Hi,
>
> I have a data like this
>
> Start_time   End_time
> 12:10:30     13:10:00
>
> I want to store this in pig and calculate elapsed time.
> How can i do this in pig ?
> I simply wrote Start_time-End_time but the result is blank
>
> Regards,
> Chhaya Vishwakarma
>
>
> ________________________________
> The contents of this e-mail and any attachment(s) may contain confidential
> or privileged information for the intended recipient(s). Unintended
> recipients are prohibited from taking action on the basis of information in
> this e-mail and using or disseminating the information, and must notify the
> sender and delete it from their system. L&T Infotech will not accept
> responsibility or liability for the accuracy or completeness of, or the
> presence of any virus or disabling code in this e-mail"
>



-- 
Regards,
Abhishek Agarwal

Reply via email to