pig tutorial - apache pig tutorial - Apache Pig - GetSecond() - pig latin - apache pig - pig hadoop
What is GetSecond() in Apache Pig ?
- The getSeconds() method returns the seconds (from 0 to 59) of the specified date and time.
- This function accepts a date-time object as a parameter and returns the seconds of the current minute of a given date-time object.
- Ensure that you have a file named wikitechy_date.txt in the HDFS directory /pig_data/ as given below. This file contains the date-of-birth details of a particular person, id, date, and time.
- You have loaded this file into Pig with a relation named date_data as given below.
- An example of the GetSecond() function. It retrives the seconds of a minute from the given date-time object.
- Hence,generate the date-time objects of all employees using todate() function as given below.
- We get the seconds from the birth time of each employee using GetSecond() function and store it in the relation named wiki_getsecond_data as given below.
You have verify the contents of the wiki_getsecond_data relation using the Dump operator as given below.