Was there meant to be a question there? At first glance, one problem seems to be that you're loading fields delimited by semicolons, but the sample data you posted is separated by whitespace. Another is that you're defining those fields as type double, but that is probably not the best choice for timestamp data.
There are various ways to find the difference between two timestamps depending on the version of Pig that you're using, but one approach that should work in any version is to use a function to convert those timestamps to UNIX time format (i.e. of type long) and then subtract the login time from the logout time. On Thu, Sep 19, 2013 at 9:44 AM, Muni mahesh <[email protected]>wrote: > *Sample data * > > * Login Logout* > 2013-01-16 04:01:18 2013-01-16 04:01:36 > 2013-01-16 04:02:19 2013-01-16 04:03:11 > > *Query * > > grunt> A = load '/home/user/Desktop/1' using PigStorage(';') AS (f1 : > double, f2: double); > > 2013-09-19 20:19:02,316 [main] WARN org.apache.pig.PigServer - Encountered > Warning IMPLICIT_CAST_TO_DOUBLE 6 time(s). > > grunt> B = foreach A generate (f2-f1); > > 2013-09-19 20:19:04,611 [main] WARN org.apache.pig.PigServer - Encountered > Warning IMPLICIT_CAST_TO_DOUBLE 6 time(s). > > grunt> dump B; > > *output :* > > () > () > > > *Output expected * > > (18) > (52) > -- Tom Wheeler http://www.tomwheeler.com/
