(double)c/(double)v works. data = load '/home/miguel/test.txt' as (a:int,b:int); dump data; (1,2) (2,1) calc = foreach data generate (double)a/(double)b; dump calc; (0.5) (2.0)
On Thu, Jul 15, 2010 at 3:39 PM, Brian Adams <[email protected]> wrote: > ((double)c/(double)v) perhaps? > > -----Original Message----- > From: hc busy [mailto:[email protected]] > Sent: Thursday, July 15, 2010 6:36 PM > To: [email protected] > Subject: how do I convert int to double in PigLatin? > > if my table is: > > t = load 'data' as (v:int, c:int); > > and I want to do > > u = foreach t generate c/v as cov; > > how do I get fraction out of this? because > > u = foreach t generate (double)c / v; > > crashes with a casting error for me, do I write an UDF? > -- Miguel Ríos-Berríos Computer Science Graduate Student Graduate Research Assistant Human Computer Interaction Lab University of Maryland, College Park [email protected]
