Reputation: 283
How can I pass a date to a pig script in a simple yyyy-MM-dd format?
I am passing a date like below:
pig -f script.pig -param dt="2016-06-03"
Within the script, if I use:
ToDate($dt,'yyyy-MM-dd')
It shows me the output as:
1969-12-31T18:00:02.007-06:00
I tried reading from the pig ToDate documentation but it does not seem to help.
Upvotes: 1
Views: 358
Reputation: 16080
Looks like you're missing '
ToDate('$dt','yyyy-MM-dd')
check this example from documentation about parameter substitution:
%declare DESC 'Joe\'s URL'
A = load 'data' as (name, desc, url);
B = FILTER A by desc eq '$DESC';
Upvotes: 1