![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Hive
nma_123456
这个作者很懒,什么都没留下…
展开
-
hive去重操作
1、建表create table lintest(id string,name string,size int);2、插入数据create table inform(id string,name string,size int);3、去重查询select ad ,sum(plus),count(distinct name,id)from (select di原创 2016-07-22 14:02:29 · 19846 阅读 · 2 评论 -
Hive动态分区与建表、插入数据操作
1、定义动态分区指不需要为不同的分区添加不同的插入语句,分区不确定,需要从数据中获取。set hive.exec.dynamic.partition=true;//使用动态分区(可通过这个语句查看:set hive.exec.dynamic.partition;) set hive.exec.dynamic.partition.mode=nonstrict;//无限制模式 如果原创 2016-06-14 16:57:20 · 20538 阅读 · 0 评论 -
Hive java编程提交查询语句和配置
java编程配置hive参数和执行查询//设置优先级和reduce数量public static final String MR_TASKS_NUM="set mapred.reduce.tasks=40";public static final String MR_PRIORITY="set mapred.job.priority=VERY_HIGH";//将配置应用于原创 2016-06-16 18:05:35 · 878 阅读 · 1 评论 -
hive插入数据
新建表create table lintest(name string,id string)添加新列alter table lintest add columns(plus int)向表中插入数据insert overwrite table lintestselect uuid,deviceid,'1',count(deviceid) as num from kuaiya.原创 2016-07-08 15:35:31 · 2267 阅读 · 0 评论 -
实践rank,dense_rank,row_number区别
1、新建表create table score(name string,subject string,score string);2、插入数据insert into score values('1','En','80'),('2','En','80'),('3','En','90'),('4','En','60'),('5','En','70'),('6','En','81'),('8原创 2016-08-30 11:02:59 · 440 阅读 · 0 评论 -
case when用法
1、划分时间段select deviceid,case when server_time >=20160825000000 and server_time when server_time >=20160825010000 and server_time when server_time >=20160825020000 and server_time when server_原创 2016-08-31 16:30:54 · 559 阅读 · 0 评论 -
Hive函数
1、Array创建数据库表,以array作为数据类型create table person(name string,work_locations array)ROW FORMAT DELIMITEDFIELDS TERMINATED BY '\t'COLLECTION ITEMS TERMINATED BY ',';2、Map创建数据库表create table score(转载 2016-09-05 14:12:15 · 407 阅读 · 0 评论