Hive 变量和属性
Hive 中变量和属性命名空间

下面我们来用几个例子操作下:
&hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/apache-hive-2.1.0-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Logging initialized using configuration in jar:file:/home/hadoop/apache-hive-2.1.0-bin/lib/hive-common-2.1.0.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
1. hive> set env:HOME;
env:HOME=/home/hadoop
this is didsplay /home/user
2. set; and set -v 这两个命令都会打印出hivevar, hiveconf, system, env的变量,但是带-v的命令会在这个的基础上打印出所有定义的属性,如: HDFS和MapReduce的属性
3. 我们可以用'Set' 命令去 为一个变量赋值,以及打印出变量值。
$hive --define foo=bar
hive> set foo;
foo=bar
hive> set hivevar:foo
> ;
hivevar:foo=bar
hive> set hivevar:foo=bar2;
hive> set foo;
foo=bar2
hive> set hivevar:foo;
hivevar:foo=bar2
hivevar: is one optional --hivevar and --define are same
hive> create table toss1(i int, ${hivevar:foo} string);
OK
Time taken: 7.339 seconds
hive> describe toss1;
OK
i int
bar2 string
Time taken: 1.773 seconds, Fetched: 2 row(s)
hive> create table toss2(i2 int, ${foo} string);
OK
Time taken: 0.769 seconds
hive> describe toss2;
OK
i2 int
bar2 string
Time taken: 0.463 seconds, Fetched: 2 row(s)
我们学习再学习下--hiveconf选项, Hive v0.7.*版本支持这个功能,其用于配置hive行为的所有属性。我们用它来指定Hive v0.8.0版本中增加的hive.cli.print.current.db属性。开启这个属性可以在CLI提示符打印当前所在的数据库名。默认为default.而且默认为false.
Let's learn --hiveconf optional, this function is surpported by Hive v0.7.*.
hive --hiveconf hive.cli.print.current.db=true
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/apache-hive-2.1.0-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Logging initialized using configuration in jar:file:/home/hadoop/apache-hive-2.1.0-bin/lib/hive-common-2.1.0.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive (default)> set hive.cli.print.current.db;
hive.cli.print.current.db=true
hive (default)> set hiveconf:hive.cli.print.current.db;
hiveconf:hive.cli.print.current.db=true
hive (default)> set hiveconf:hive.cli.print.current.db =false;
hive> set hiveconf:hive.cli.print.current.db;
hiveconf:hive.cli.print.current.db=false
Hive 变量和属性的更多相关文章
- Hive之变量和属性
首先看一下hive cli工具对于变量的定义规定的几项功能: $ bin/hive -h usage: hive -d,--define <key=value> Vari ...
- runtime第二部分成员变量和属性
接上一篇 http://www.cnblogs.com/ddavidXu/p/5912306.html 转载来源http://www.jianshu.com/p/6b905584f536 http:/ ...
- iOS 成员变量,实例变量,属性变量的区别,联系
在ios第一版中: 我们为输出口同时声明了属性和底层实例变量,那时,属性是oc语言的一个新的机制,并且要求你必须声明与之对应的实例变量,例如: 注意:(这个是以前的用法) @interface MyV ...
- Objective-C Runtime 运行时之二:成员变量与属性
类型编码(Type Encoding) 作为对Runtime的补充,编译器将每个方法的返回值和参数类型编码为一个字符串,并将其与方法的selector关联在一起.这种编码方案在其它情况下也是非常有用的 ...
- Objective-C Runtime 运行时之二:成员变量与属性(转载)
在前面一篇文章中,我们介绍了Runtime中与类和对象相关的内容,从这章开始,我们将讨论类实现细节相关的内容,主要包括类中成员变量,属性,方法,协议与分类的实现. 本章的主要内容将聚集在Runtime ...
- .NET中公共变量与属性的区别
在我们的程序中经常会出现以下的代码: 如: 成员变量 public string Name; 或者用属性 private string name ...
- UNIX环境高级编程——线程同步之条件变量以及属性
条件变量变量也是出自POSIX线程标准,另一种线程同步机制.主要用来等待某个条件的发生.可以用来同步同一进程中的各个线程.当然如果一个条件变量存放在多个进程共享的某个内存区中,那么还可以通过条件变量来 ...
- OC基础成员变量、属性变量、实例方法与类方法
首先,为什么我们要定义一个新类呢?按照我的理解,就是为了抽象出来一个新的东西(也就是类),用来存储更多的数据变量和方法,一切类都直接或间接继承与NSObject. 在类的头文件里我们可以定义成员变量. ...
- ios -- 成员变量、实例变量与属性的区别
最近打开手机就会被胡歌主演的<猎场>刷屏,这剧我也一直在追,剧中的郑秋冬,因为传销入狱五年,却在狱中拜得名师孙漂亮(孙红雷),苦学HR,并学习了心理学,成功收获两样法宝.出狱后因为怕受 ...
随机推荐
- Win10 VS2013 suitesparse-metis-for-windows 1.3.1
suitesparse-metis-for-windows 1.3.1 安装包内附SuiteSparse 4.5.1, Metis 5.1.0和 lapack 3.4.1 Github上面由整理好的s ...
- PDF的一些工具
PdfStreamDumper Pdftk 这里有一个链接,列出了很多pdf免费工具 https://en.wikipedia.org/wiki/Category:Free_PDF_software ...
- How a web page loads
The major web browsers load web pages in basically the same way. This process is known as parsing an ...
- [转]Oracle截取字符串相关函数
转至:http://www.cnblogs.com/qmfsun/p/4493918.html 1.instr(sourceString,destString,start,appearPosition ...
- .NET DataTable DataSet转json代码
/// <summary> /// dataTable转换成Json格式 /// </summary> /// <param name="dt"> ...
- RedHat6安装git
通过yum安装git : 一. 先配置yum: 把redhat系统镜像加载到电脑光驱中(无光驱可用u盘),然后把该镜像配置到环境变量中 文件名不限 在此新建的RHEL_6文件中添加如下内容 其中bas ...
- Linux_Shell_ Map 的使用和遍历
定义初始化map declare -A map=([") 输出所有key echo ${map[@]} 输出key对应的值 "]} 遍历map for key in ${!map[ ...
- 算法训练 Pollution Solution(计算几何)
问题描述 作为水污染管理部门的一名雇员,你需要监控那些被有意无意倒入河流.湖泊和海洋的污染物.你的其中一项工作就是估计污染物对不同的水生态系统(珊瑚礁.产卵地等等)造成的影响. 你计算所使用的模型已经 ...
- the ssl module in Python is not available错误解决
在使用pip安装pymongo的过程中报错,提示如下: $ pip3 install pymongo pip is configured with locations that require TLS ...
- windows-bat配置环境变量的几个坑点
今天因为学校机房问题,想自动化安装vim,不料在编bat的时候不熟练,搞了很久. 坑点1.%path%访问到的是用户的path,而不是系统的path.所以增加环境变量的时候只能增加用户的path.我就 ...