No function is mapped to the name "coord:formatTime"
Asked Answered
I

2

2

I am trying to get the current timestamp using the below in oozie:

<property>
 <name>date</name>
 <value>${coord:formatTime(coord:dateOffset(coord:nominalTime(), -1,
                         'DAY'), "yyyy-MM-dd")}
  </value>
 </property>

My hive action is:

<script>/abc/test.hql</script>
 <param>DATE=${date}</param>

My Hive action fails saying:

EL_ERROR

No function is mapped to the name "coord:formatTime"

Any idea why it says so?I want my date as YYYY-MM-DD HH-MM-SS

Illumination answered 1/8, 2016 at 16:57 Comment(1)
As you might guess, the coord NameSpace contains all EL function that are valid inside a Coordinator XML script only. And I would bet that you tried it inside a Workflow script (but it's hard to know for sure because you did not care to show your script in context).Redroot
E
1
${coord:formatTime(coord:dateOffset(coord:nominalTime(), -1, 'DAY'), 'yyyyMMdd')}

This works for me. Which version of oozie do you use ?

Ediva answered 3/8, 2016 at 6:42 Comment(0)
T
1

Use the documentation for coord:formatTime

6.8.2. coord:formatTime(String ts, String format) EL Function (since Oozie 2.3.2)

So probably your Oozie version is lower than 2.3.2 Also it's important to pay attention for the xmlns version inside your coordinator xml

xmlns:coordinator="uri:oozie:coordinator:

Hope this help

Tysontyumen answered 2/8, 2016 at 19:31 Comment(0)
E
1
${coord:formatTime(coord:dateOffset(coord:nominalTime(), -1, 'DAY'), 'yyyyMMdd')}

This works for me. Which version of oozie do you use ?

Ediva answered 3/8, 2016 at 6:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.