关于如何在Apache Pig中将Float数据类型舍入到2位小数的任何想法?
例如:
test = FOREACH (JOIN Load by (Op1, Op2), Load2 by (Op3,Op4)) GENERATE
Load2::Number2 *Load::Number1 as Output
字段Number1和Number2是浮点数。我当前的计算给出了5到6个小数位。
答案 0 :(得分:0)
试试这个:
B = FOREACH A GENERATE (((A.myfloat1 * A.myfloat2)*100f)ROUND)/100f AS myfloat3