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

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

问题描述

从配置单元-h:

   -  hiveconf< property = value>为给定属性使用值
--hivevar< key = value>变量替代应用于配置单元
命令。例如--hivevar A = B


解决方案

感觉就像文档中的例子是足够的,所以这里是我的答案。



一开始只有 - hiveconf code>和变量替换不存在。

- hiveconf 选项允许用户设置 Hive配置值,就是这样。所有Hive配置值都存储在 hiveconf 命名空间下,即 hiveconf:mapred.reduce.tasks 。这些值允许您控制诸如映射器和缩减器的数量,如果应该显示状态消息,并且脚本应该继续出现错误。



稍后,添加了变量替换。这意味着您现在可以在使用 $ {...} 语法的查询中使用变量。然而,你可以从命令行设置的唯一变量在 hiveconf 命名空间下,使用 - hiveconf ,所以



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

总结:

<$ c应该使用$ c> hiveconf
命名空间和 - hiveconf 来设置Hive配置值。

<$ c $应该使用c> hivevar 命名空间和 - hivevar 来定义用户变量。

hiveconf namespace可能不会破坏任何东西,但不推荐使用。


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.

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

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.

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.

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.

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天全站免登陆