问题
I have created two hive scripts script1.hql and script2.hql.
Is it possible to run the script script2.hql from script1.hql?
I read about using the source command, but could not get around about its use. Any pointers/ref docs will be appreciated..
回答1:
Use source <filepath>
command:
source /tmp/script2.hql; --inside script1
The docs are here: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli
Hive will include text of /tmp/script2.hql and execute it in the same context, so all variables defined for main script will be accessible script2 commands.
source
command looks for local path (not HDFS). Copy file to local directory before executing.
回答2:
Try using command and see if you can execute
hive -f /home/user/sample.sql
来源:https://stackoverflow.com/questions/49535875/can-a-hive-script-be-run-from-another-hive-script