可以从另一个配置单元脚本运行配置单元脚本吗? [英] Can a hive script be run from another hive script?

查看:67
本文介绍了可以从另一个配置单元脚本运行配置单元脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have created two hive scripts script1.hql and script2.hql.

是否可以从script1.hql运行脚本script2.hql?

Is it possible to run the script script2.hql from script1.hql?

我阅读了有关使用source命令的信息,但是无法理解其用法. 任何指针/参考文档将不胜感激.

I read about using the source command, but could not get around about its use. Any pointers/ref docs will be appreciated..

推荐答案

使用source <filepath>命令:

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

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

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

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命令查找本地路径(不是HDFS).在执行之前将文件复制到本地目录.

source command looks for local path (not HDFS). Copy file to local directory before executing.

这篇关于可以从另一个配置单元脚本运行配置单元脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆