pig tutorial - apache pig tutorial - Apache Pig - GetWeekYear() - pig latin - apache pig - pig hadoop
What is GetWeekYear() in Apache Pig ?
- The GetWeekYear() function accepts a date-time object as a parameter and returns the current week year from the given date-time object.
- Ensure that you have a file named wikitechy_date.txt in the HDFS directory /pig_data/ as shown 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 shown below.
- An example of the GetWeekYear() function.
- It will retrive the current week year from the given date-time object.
- Hence, we generate the date-time objects of all employees using todate() function as shown below.
- Let us get the month from the date-of-birth of each employee using GetWeekYear() function and store it in the relation named getweekyear_data as shown below.
- You have verify the contents of the getweekyear_data relation using the Dump operator.