一个配置单元脚本可以来自另一个配置单元脚本 运行 吗?

Can a hive script be run from another hive script?

我创建了两个配置单元脚本 script1.hql 和 script2.hql。

是否可以 运行 来自 script1.hql 的脚本 script2.hql?

我阅读了有关使用 source 命令的信息,但无法绕过它的使用。 任何 pointers/ref 文档将不胜感激..

试试用命令看看能不能执行

hive -f /home/user/sample.sql

使用source <filepath>命令:

source /tmp/script2.hql; --inside script1

文档在这里:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli

Hive 将包含 /tmp/script2.hql 的文本并在相同的上下文中执行它,因此为主脚本定义的所有变量都可以访问 script2 命令。

source 命令查找本地路径(不是 HDFS)。执行前复制文件到本地目录。