Search code examples
hiveooziehue

Hue: oozie parameters


I want to pass 2 parameters to my Hiveql script in oozie, my script:

ALTER TABLE default.otarie_appsession 
ADD IF NOT EXISTS PARTITION ( insert_date=${dt},hr=${hr} );

My Oozie workflow :

enter image description here

When i send the job it ask for parameter values, so i put:

enter image description here

And this is the error:

2016-02-05 18:41:55,460 WARN org.apache.oozie.action.hadoop.HiveActionExecutor: SERVER[DVS1VM65] USER[root] GROUP[-] TOKEN[] APP[My_Workflow] JOB[0000290-160122145737153-oozie-oozi-W] ACTION[0000290-160122145737153-oozie-oozi-W@hive-a586] Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.HiveMain], exit code [40000]

This is the XML of the workflow:

<workflow-app name="My_Workflow" xmlns="uri:oozie:workflow:0.5">
    <start to="hive-a586"/>
    <kill name="Kill">
        <message>L&#39;action a échoué, message d&#39;erreur[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <action name="hive-a586">
        <hive xmlns="uri:oozie:hive-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
              <job-xml>/user/oozie/some_scripts/hive-site.xml</job-xml>
            <script>/user/oozie/some_scripts/addpart.hql</script>
              <param>hr=</param>
              <param>dt=</param>
        </hive>
        <ok to="End"/>
        <error to="Kill"/>
    </action>
    <end name="End"/>
</workflow-app>

When i remove all parmeters and use hard coded value, the script works fine, so its clear that i have problem to pass parameters. And my final goal is to pass current date and hour.

Thank you.


Solution

  • What about setting Hive parameters with Oozie parameters...

    <param>hr=${bilouteHR}</param>
    <param>dt=${bilouteDT}</param>
    

    ...then setting values for these Oozie parameters at submission time?

    bilouteHR
         00
    bilouteDT
         20160105
    

    Hope that solves your issue, biloute.