You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Shin Chan <ha...@gmx.com> on 2012/04/19 11:39:30 UTC

Timestamp variable as parameter gives unexpected arguments error

Hello All

 If i give following variable from command line it does not work

 -param TIMESTAMP = 'date +%c'

 It gives error

 java.lang.RuntimeException: Encountered unexpected arguments on command line - please check the command line

 But if i enter something like

 TIMESTAMP=`date +%Y-%m-%d` it works , but i want full date including time (2012-04-14 11:24 etc) , how to set this.

 I want to capture time stamp at which pig script was started inside the output of that script

Thanks and Regards ,

Re: Timestamp variable as parameter gives unexpected arguments error

Posted by Dan Feldman <hr...@gmail.com>.
Hi Shin,

Try %DECLARE TIME_STAMP `date "+%y-%m-%d %H%M%S"`

or, alternatively, -param TIME_STAMP=`date "+%y-%m-%d %H%M%S"` when you
call the script (just make sure there are no spaces around the "=" sign and
"" around the format.

At least that's how we are doing it, and seems to be working..

Dan F.

On Thu, Apr 19, 2012 at 2:39 AM, Shin Chan <ha...@gmx.com> wrote:

> Hello All
>
>  If i give following variable from command line it does not work
>
>  -param TIMESTAMP = 'date +%c'
>
>  It gives error
>
>  java.lang.RuntimeException: Encountered unexpected arguments on command
> line - please check the command line
>
>  But if i enter something like
>
>  TIMESTAMP=`date +%Y-%m-%d` it works , but i want full date including time
> (2012-04-14 11:24 etc) , how to set this.
>
>  I want to capture time stamp at which pig script was started inside the
> output of that script
>
> Thanks and Regards ,
>