Pig Round Decimal to Two Places


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.


Try this:

B = FOREACH A GENERATE (((A.myfloat1 * A.myfloat2)*100f)ROUND)/100f AS myfloat3


  • Infix to Postfix conversion c++
  • Python unexpected EOF while parsing (python2.7)
  • JavaScript Variable Operators
  • Parsing 'Complex' JSON with Pig
  • Pig - use ternary condition to filter based on different condition
  • What is the difference between == vs equals() in Java?
  • Setting up Swagger (ASP.NET Core) using the Authorization headers (Bearer)
  • Setting up Swagger (ASP.NET Core) using the Authorization headers (Bearer)
  • Can I pass a select value as a param to an onchange function? [duplicate]
  • creating dummy variable based on event date within certain time-period
  • Declare a comma seperated string constant
  • Comma delimited string to individual rows - Impala SQL
  • I don't get what's the difference between format() and … (python)
  • How to define an array of floats in Shader properties?
  • Scala: Function returning an unknown type
  • Extract All Possible Paths from Expression-Tree and evaluate them to hold TRUE
  • XSLT foreach repeating nodes to flat
  • List images(01.png) and descriptions(01.txt) from directory
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Loading .coffee files via a view in Rails
  • What and where is mdimport
  • Does it make sense to call System.gc() and Thread.sleep() when working on Bitmaps?
  • Create DicomImage from scratch using Dcmtk
  • D3 nodes and links from JSON with nested arrays of children
  • Django: Count of Group Elements
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Get object from AWS S3 as a stream
  • How to check if every primary key value is being referenced as foreign key in another table
  • How to handle AllServersUnavailable Exception
  • JSON with duplicate key names losing information when parsed
  • Jquery - Jquery Wysiwyg return html as a string
  • How to get next/previous record number?
  • embed rChart in Markdown
  • How to get Windows thread pool to call class member function?
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • How to load view controller without button in storyboard?