Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oozie create a parameter with today date

How can I create a parameter with today date of the format :

yyyy-mm-dd

in oozie. I am passing this variable to hive script which is adding the partition for that date, I found the function to create timestamp using :

<param>DATE=${wf:timestamp()}</param>

which should return output in the form :

(YYYY-MM-DDThh:mm:ss.sZ). I.e.: 1997-07-16T19:20:30.45Z

but I am getting error :

No function is mapped to the name "wf:timestamp"

Also I only want YYYY-MM-DD from the timestamp and there is no substring function also which can give me first 10 chars of the string.

like image 506
bigData Avatar asked May 26 '14 20:05

bigData


1 Answers

For the basic EL function , you don't need to add wf so it should look like this

<param>DATE=${timestamp()}</param>

If you are using coordinator , than use can simple add new param to wf. it should look something like this

<action>
        <workflow>
            <app-path>${appPath}</app-path>
            <configuration>
                        <property>
                            <name>reportDate</name>
                            <value>${coord:formatTime(coord:dateOffset(coord:nominalTime(), -1,
                                'DAY'), "yyyy-MM-dd")}
                            </value>
                        </property>
              </configuration>
        </workflow>
</action>
like image 60
Mzf Avatar answered Sep 16 '22 11:09

Mzf