pig tutorial - apache pig tutorial - Apache Pig GetMilliSecond(datetime) Function - pig latin - apache pig - pig hadoop
What is GetMilliSeconds(datetime) Function in Apache Pig ?
- The GetMiliSeconds(datetime) function will accept a date-time object as a parameter and will returns the milliseconds of the current second of date-time object.
- The GetMilliSeconds() method returns the milliseconds (from 0 to 999) of the specified date and time.
- The GetMilliSeconds() gets the milliseconds component of the date which is represented by this instance.
- Ensure that we have a file name 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 person id, date and time.
- We have loaded this file into Pig with a relation name called date_data which is given below:
- The function will retrieve the milliseconds of the current second from the date-time object.
- We need to generate the date-time objects of all the employees using by todate() function which is given below:
- We need to get the seconds from the birth time of each employee by using GetMilliSecond() function and store it in the relation called getmillisecond_data which is given below:
- We need to verify the contents of the getmillisecond_datarelation by using Dump operator which is given below.
- The above statement stores in the relation named getmillisecond_data