- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to substractduration of 1min from a ISO time in Pig ?
- Labels:
-
Apache Pig
Created ‎01-25-2016 10:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎01-27-2016 09:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
all the comments mentioned here are correct,this is small example emp = load 'data' using PigStorage(',') as (empno,ename ,job,mgr,hiredate ,sal,comm,deptno); each_date = foreach emp generate ToDate(hiredate,'dd-MMM-yyyy') as mydate; subt = foreach each_date generate mydate,SubtractDuration(mydate,'PT1M'); dump subt;
Created ‎01-25-2016 10:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎01-25-2016 11:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you need to refer to the standard for ISO 8601 to specify duration or period linked Here. For example PT1M is a one-minute duration. Here's the implementation of the function if you need clear understanding. Get to know jodatime java library and Period object to get a handle on this function. Excellent question!
Created ‎01-27-2016 09:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
all the comments mentioned here are correct,this is small example emp = load 'data' using PigStorage(',') as (empno,ename ,job,mgr,hiredate ,sal,comm,deptno); each_date = foreach emp generate ToDate(hiredate,'dd-MMM-yyyy') as mydate; subt = foreach each_date generate mydate,SubtractDuration(mydate,'PT1M'); dump subt;
Created ‎01-27-2016 09:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use ISO time pattern instead of dd-MMM-yyyy from my code
