pig tutorial - apache pig tutorial - Apache Pig - EXP() - pig latin - apache pig - pig hadoop
What is EXP() function?
- The exponential function, exp(x), calculates the value of e to the power of x, where e is the base of the natural logarithm, 2.718281828... .
- You can enter the command exp using either the 1-D or 2-D calling sequence.
- For example, exp(-1) is equivalent to . ... exp(1) is used instead.
Learn apache pig - apache pig tutorial - exp function in apache pig - apache pig examples - apache pig programs
EXP() function in Apache Pig
- The EXP() function of Pig Latin is used to get the Euler’s number e raised to the power of x for given expression.
Syntax:
Example:
- Ensure that we have a file named wikitechy_exp.txt in the HDFS directory /pig_data/.
- This file contains integer and floating point values as shown below.
Wikitechy_exp.txt
- You have loaded this file into Pig with a relation named exp_data as given below.
- You compute the exp values of the contents of the wikitechy_exp.txt file using EXP() function as given below.
The above statement stores the result in the relation named exp_data.
Verification:
- Now you can verify the contents of the relation using the Dump operator as given below.
Output:
The output shows that the result in the file>exp _data.