pig tutorial - apache pig tutorial - Apache Pig - MinutesBetween(datetime1, datetime2) Function - pig latin - apache pig - pig hadoop
What is MinutesBetween(datetime1, datetime2) Function in Apache Pig ?
- The function MinuteBetween(datetime1,datetime2) accept two date-time objects and will calculates the number of minutes which are given between the two given date-time objects.
- The function MinutesBetween(datetime1,datetime2) returns the number of minutes which is given between two specified datetime values.
- The function MinutesBetween(datetime1,datetime2) will always return the positive result and the parameter values which are interchangeable.
- Ensure that we have a file named wikitechy_doj_dob.txt in the HDFS directory /pig_data/.
- The file contains the date-of-birth details and date-of-joining details of a particular person, id, dateof-birth, and date-of-joining.
- We have loaded the file into Pig with a relation name called doj_dob_data which is given below.
- We need to calculate the number of minutes between date-of-birth and date-of-joining of the employees by using the MinutesBetween() function which is given below:
- We need to verify the contents of the relation using the Dump operator as shown below.
- The above statement stores the result in the relation named minutesbetween_data.