pig tutorial - apache pig tutorial - Apache Pig - Math Functions - pig latin - apache pig - pig hadoop

What is math function?

  • In mathematics, a function is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output.
  • An example is the function that relates each real number x to its square x2.
  • For general information about apache pig math functions.
  • Pig function names are case sensitive and UPPER CASE.
  • Pig may process results differently than as stated in the Java API Specification:
  • If the result value is null or empty, Pig returns null.
  • If the result value is not a number (NaN), Pig returns null.
  • If Pig is unable to process the expression, Pig returns an exception.

The following Math functions in Apache Pig

S.N. Syntax Functions & Description
1 ABS(expression) To get the absolute value of an expression.
2 ACOS(expression) To get the arc cosine of an expression.
3 ASIN(expression) To get the arc sine of an expression.
4 ATAN(expression) This function is used to get the arc tangent of an expression.
5 CBRT(expression) This function is used to get the cube root of an expression.
6 CEIL(expression) This function is used to get the value of an expression rounded up to the nearest integer.
7 COS(expression) This function is used to get the trigonometric cosine of an expression.
8 COSH(expression) This function is used to get the hyperbolic cosine of an expression.
9 EXP(expression) This function is used to get the Euler’s number e raised to the power of x.
10 FLOOR(expression) To get the value of an expression rounded down to the nearest integer.
11 LOG(expression) To get the natural logarithm (base e) of an expression.
12 LOG10(expression) To get the base 10 logarithm of an expression.
13 RANDOM( ) To get a pseudo random number (type double) greater than or equal to 0.0 and less than 1.0.
14 ROUND(expression) To get the value of an expression rounded to an integer (if the result type is float) or rounded to a long (if the result type is double).
15 SIN(expression) To get the sine of an expression.
16 SINH(expression) To get the hyperbolic sine of an expression.
17 SQRT(expression) To get the positive square root of an expression.
18 TAN(expression) To get the trigonometric tangent of an angle.
19 TANH(expression) To get the hyperbolic tangent of an expression.

Related Searches to Apache Pig - Math Functions