Can a hive script be run from another hive script?

别说谁变了你拦得住时间么 提交于 2019-12-13 16:21:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!