![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hive
jo_joo
这个作者很懒,什么都没留下…
展开
-
<1>hive的一些基本操作
1.创建库create database if not exists mydb;添加注释create database if not exists mydb2comment 'this is test database';查看注释describe database mydb2;删除库drop database if exists mydb2;(库中没有表的情况)drop data...原创 2018-08-16 21:07:06 · 162 阅读 · 0 评论 -
<2>hive 外部表,分区表,动态分区,桶表,视图
1.分区表create table sample_data(id int,name string,gender string,x int,y int,z int)row format delimited fields terminated by','load data inpath '/student/sampleData.txt' into table sample_data;cr...原创 2018-08-16 21:11:10 · 736 阅读 · 0 评论 -
<3>hive 查询,排序,函数
6.查询简单查询配置:set hive.fetch.task.conversion=more;/hive --hiveconf hive.fetch.task.conversion=more;/修改hive-site.xml文件;函数nvl(x,0)不为空的则为0当有值为空时的判断 is null/is not nullHQL严格区分字符大小写:select * from view_stu...原创 2018-08-16 21:28:58 · 241 阅读 · 0 评论 -
<4> hive 执行命令方式,数据加载
hive执行命令的方式hive -e "hql" 命令行执行hsqlhive -e "select * from mydb2.c1"hive -S 静默模式,控制台不输出Logging信息hive -S -e "select * from mydb2.c1"hive -v 详细模式,会把执行的sql打印出来hive -v -e "select * from mydb2.c1"hive...原创 2018-08-16 21:32:18 · 663 阅读 · 0 评论 -
<5>hive 数据导出和动态分区
hive 数据导出1.hadoop命令的方式gethadoop fs -get path localPathtext(可以对多种不同格式进行操作,相当于输出流改成了text)hadoop fs -text path > e2.txt2.通过insert...directory方式insert overwrite local directory 'path' row format...原创 2018-08-16 21:33:56 · 393 阅读 · 0 评论 -
<6> hive 表属性操作
表属性操作修改表名create table if not exists testchange(name string,value string);alter table testchange rename to a2;增加列(默认添加到最后)alter table tablename add columns(c1 string,c2 long);alter table a2 add ...原创 2018-08-16 21:35:41 · 347 阅读 · 0 评论 -
<7> hive group by,order by
group by ...having1.select 后面非聚合列必须出现在group by 中2.除了普通的列就是一些聚合操作3.group by 后面可以跟表达式,比如substr(col)4.group by 使用了reduce操作,受限于reduce数量,设置reduce参数mapred.reduce.task改变reduce数量(hive-0.13)set mapreduce.j...原创 2018-08-16 21:37:35 · 1119 阅读 · 0 评论