pig tutorial - apache pig tutorial - Apache Pig - GetMinute(datetime) Function - pig latin - apache pig - pig hadoop
What is GetMinute(datetime) Function in Apache Pig ?
- TheGetMinute(datetime) function will accept a date-time object as parameter and will return the minute of the current hour of date-time object.
- The GetMinutes(datetime) method returns the of the specified date and time
- The GetMinute(datetime) functionextracts the minute portion as a string from the dtl value.
Syntax
Example
- Ensure that there is a file named wikitechy_date.txt in the HDFS directory /pig_data/ which is given below:
- The file contains the date-of-birth details of a particular person, where it has the id, date, and time.
wikitechy_date.txt wikitechy_date.txt
- We have loaded the file into Pig with a relation name called date_data which is given below:
- This function will retrieve the minute of the hour from the given date-time object.
- We need to generate the date-time objects of all the employees by using todate() function.
- We need to get the minutes from the birth time of each employee by using GetMinute() function and also store it in the relation name calledgetminute_data which is given below:
Verification
- We need to verify the contents of the getminute_data relation by using the Dump operator which is given below:
Output:
- The above statement stores in the relation named getminute_data