pig tutorial - apache pig tutorial - Apache Pig - COSH() - pig latin - apache pig - pig hadoop

What is cosh() function?

  • The inverse hyperbolic functions are the area hyperbolic sine "arsinh" (also denoted "sinh−1", "asinh" or sometimes "arcsinh") and so on.
  • Just as the points (cos t, sin t) form a circle with a unit radius, the points (cosh t, sinh t) form the right half of the equilateral hyperbola.
 cosh function in apache

Learn apache pig - apache pig tutorial - cosh function in apache - apache pig examples - apache pig programs

COSH() function in Apache Pic

  • The COSH() function of Pig Latin is used to compute the hyperbolic cosine of a specified expression.


grunt> COSH(expression)


  • Ensure that we have a file named wikitechy_math.txt in the HDFS directory /pig_data/.
  • This file contains integer and floating point values as shown below.


  • You have loaded this file nito Pig with a relation named math_data as given below.
grunt> math_data = LOAD 'hdfs://localhost:9000/pig_data/wikitechy_math.txt' USING PigStorage(',')
   as (data:float);
  • You compute the hyperbolic cosine values of the contents of the wikitechy_math.txt file using COSH() function as shown below.
grunt> cosh_data = foreach math_data generate (data), COSH(data);
  • Above statement stores the result in the relation named cosh_data.


Now you can the contents of the relation using the Dump operator as given below.

grunt> Dump cosh_data; 


The output shows that the result in the file>cosh_data.


Related Searches to Apache Pig - COSH()