You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Nishanth S <ni...@gmail.com> on 2014/12/04 00:30:46 UTC

Request Help in Date formatter

Hey All,


I am trying to convert  one date format to another in pig in the below
format.I am running into the below exception.My code is as  follows.Any
help or pointers is appreciated


colsDate = FOREACH cols GENERATE ToDate(eventTs, 'yyyy-MM-dd') as
(dt:datetime);

Sample Date format : 2014-12-02T17:25:10.734Z
pig version :0.12



2014-12-03 23:23:19,639 [main] INFO
 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher
- Failed!
2014-12-03 23:23:19,652 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 1066: Unable to open iterator for alias colsDate. Backend error :
Exception while executing [POUserFunc (Name:
POUserFunc(org.apache.pig.builtin.ToDate2ARGS)[datetime] - scope-4 Operator
Key: scope-4) children: null at []]: java.lang.IllegalArgumentException:
Invalid format: "2014-12-02T17:25:10.953Z" is malformed at "T17:25:10.953Z"


Thanks,
Nishanth