Formatting number in Apache Hive

Because of the many built-in functions provided by Apache Hive, the job made it easy for analysts, developers and programmers in most instances. Instead of using casting/converting functions to transform the integer values to decimal values, Hive provided a direct function that helps in those situations.

Syntax: FORMAT_NUMBER(number x, int d)
Formats the number X to a format like ‘#,###,###.##’, rounded to D decimal places, and returns the result as a string. If D is 0, the result has no decimal point or fractional part.

This returns 12,345,678.00

format_number in Hive

Hope you liked this post.

Please click on the follow button to receive updates on latest posts.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s