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.

Syntax:

grunt> COSH(expression)

Example:

  • 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.

Wikitechy_math.txt

5 
16 
9 
2.5 
5.9 
3.1	
  • 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.

Verification:

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

grunt> Dump cosh_data; 

Output:

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

(5.0,74.20994852478785) 
(16.0,4443055.260253992) 
(9.0,4051.5420254925943) 
(2.5,6.132289479663686) 
(5.9,182.52012106128686) 
(3.1,11.121499185584959)

Related Searches to Apache Pig - COSH()

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×