pig-user  

RE: Hello + Type Massage Question

Olga Natkovich
Tue, 23 Sep 2008 13:48:50 -0700

Try the types branch it has full support for types and explicit type
casting.

Olga 

> -----Original Message-----
> From: Paul O'Leary [EMAIL PROTECTED] 
> Sent: Tuesday, September 23, 2008 1:20 PM
> To: pig-user@incubator.apache.org
> Subject: Hello + Type Massage Question
> 
> Hi All,
> 
> Finally have the opportunity to use Pig in my day job.  
> Things are going well; doing some pretty real stuff!
> 
> Quick type massage question, a minor issue really.
> 
> I have an expression that looks like this:
> 
> (TOTAL_PYMT_POSI_AMT EQ '' ? 0 : TOTAL_PYMT_POSI_AMT) - 
> (TOTAL_PYMT_NEG_AMT EQ '' ? 0 : TOTAL_PYMT_NEG_AMT) as TOTAL_PYMT_AMT
> 
> Pig seems to implicitly cast the types to float/double so the 
> resulting data field - when dumped - has a decimal, which I 
> don't want.
> 
> Is there a way for me to cast the result of the calculation 
> to an integer, which is what I *do* want?
> 
> I noticed the syntax TOTAL_PYMT_AMT:int somewhere but that 
> doesn't seem to work...
> 
> Thanks in advance,
> PaulO.
> 
>