0

Any ideas on how I Can Round a Float data type to 2 decimal places in Apache Pig?

For example:

  test = FOREACH (JOIN Load by (Op1, Op2), Load2 by (Op3,Op4)) GENERATE 
  Load2::Number2 *Load::Number1 as Output

The fields Number1 and Number2 are floats.My current calculations give me 5 to 6 decimal places.

4

1 回答 1

0

尝试这个:

 B = FOREACH A GENERATE (((A.myfloat1 * A.myfloat2)*100f)ROUND)/100f AS myfloat3
于 2013-03-21T14:11:20.000 回答