Member since
01-15-2016
2
Posts
0
Kudos Received
0
Solutions
01-18-2016
01:22 PM
Hi Neeraj, thank you for the quick reply and help. It worked and I was able to convert the format. Big thanks. 🙂
... View more
01-18-2016
10:31 AM
Hi everyone, I just started
working with Hadoop a few weeks ago and already accoutered an issue with the date
format that I am not able to solve even so it is probably quite simple. The input looks as
follows: 102,2009-10-08
12:00:00,3,3000100,2009-10-08 15:11:00,3,1500101,2009-11-20 23:59:00,2,1560103,2008-05-20 01:00:00,4,2060 The code I am
using: a = LOAD
'/user/xyz/Orders2.txt' USING PigStorage(',') as (id:int,
date:chararray,kid:int,volume:double);b =
Foreach a Generate ToDate(date, 'yyyy/MM/dd HH:mm:ss') as dateString;DUMP b; After the execution
I am retrieving the following message: 2016-01-18
11:14:07,743 [main] INFO
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher
- Failed!
2016-01-18 11:14:07,766 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR
1066: Unable to open iterator for alias e. Backend error :
org.apache.pig.backend.executionengine.ExecException: ERROR 0: 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: "2009-10-08 12:00:00" is malformed at "-10-08
12:00:00" Do I have to use a
UDF to fix the issue or can it be solved using simple pig commands? I am grateful for
any advice.
... View more
Labels:
- Labels:
-
Apache Hive
-
Apache Pig