-hivevar 和 -hiveconf 有什么区别? [英] What is the difference between -hivevar and -hiveconf?

查看:16
本文介绍了-hivevar 和 -hiveconf 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 hive -h :

From hive -h :

--hiveconf <property=value>   Use value for given property
--hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B

推荐答案

我觉得文档中的例子不够充分,所以这是我的答案.

I didn't quite feel like the examples from the documentation were adequate, so here's my attempt at an answer.

一开始只有 --hiveconf 并且不存在变量替换.

In the beginning there was only --hiveconf and variable substitution didn't exist.

--hiveconf 选项允许用户设置 来自命令行的 Hive 配置值,就是这样.所有 Hive 配置值都存储在 hiveconf 命名空间下,即 hiveconf:mapred.reduce.tasks.这些值允许您控制诸如映射器和化简器的数量、是否应显示状态消息以及脚本是否应在出现错误时继续等内容.

The --hiveconf option allowed users to set Hive configuration values from the command line and that was it. All Hive configuration values are stored under the hiveconf namespace, i.e. hiveconf:mapred.reduce.tasks. These values allowed you to control things like the number of mappers and reducers, if status messages should be displayed, and if the script should continue on errors.

后来,添加了变量替换.这意味着您现在可以使用 ${...} 语法在查询中使用变量.但是,您可以从命令行设置的唯一变量是在 hiveconf 命名空间下使用 --hiveconf,因此用户可以在此处放置变量.

Later, variable substitution was added. This meant you could now use variables in queries with the ${...} syntax. However, the only variables you could set from the command line were under the hiveconf namespace using --hiveconf, so that's where users put their variables.

将您的个人变量放在 Hive 配置命名空间下可能不会破坏任何内容,但这也不是一个好形式.后来,有人建议hivevar 命名空间设为专门为用户变量添加,也可以使用 --hivevar 在命令行中定义.这意味着 Hive 配置值和用户定义的变量之间的分离更清晰.

Putting your personal variables under the Hive configuration namespace probably won't break anything, but it's also not good form. Later, it was suggested that a hivevar namespace be added specifically for user variables which could also be defined at the command line using --hivevar. This meant a cleaner separation between Hive configuration values and user defined variables.

总结:
hiveconf 命名空间和 --hiveconf 应该用于设置 Hive 配置值.
hivevar 命名空间和 --hivevar 应该用于定义用户变量.
hiveconf 命名空间下设置用户变量可能不会破坏任何内容,但不建议这样做.

In summary:
The hiveconf namespace and --hiveconf should be used to set Hive configuration values.
The hivevar namespace and --hivevar should be used to define user variables.
Setting user variables under the hiveconf namespace probably won't break anything, but isn't recommended.

这篇关于-hivevar 和 -hiveconf 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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