pig tutorial - apache pig tutorial - Apache Pig - SubtractDuration() - pig latin - apache pig - pig hadoop
What is SubtractDuration() function in Apache Pig ?
- The SubtractDuration() function accepts a date-time object and a duration objects, and subtract the given duration to the date-time object and returns a new date-time object.
Learn apache pig - apache pig tutorial - Apache Pig Subtract Duration - apache pig examples - apache pig programs
Syntax
Example
- Ensure that we have a file named wikitechy_date.txt in the HDFS directory /pig_data/.
- This file contains the date-of-birth details of a particular person, it has person id, date and time and some duration according to ISO 8601 standard.
wikitechy_date.txt
- We have loaded this file into Pig with a relation named date_duration as given below.
- We have loaded this file into Pig with a relation named date_duration as given below.
- Following is an example of the SubtractDuration() function.
- Now you can subtract certain duration from the given date-time object using this method as given below.
Verification
- Verify the content of this relation using the Dump operator as given below.
Output
- The result of the statement will be stored in the relation named subtractduration_data.