
hive
文章平均质量分 75
codemosi
hadoop hive hbase mahout storm spark kafka flume,等连载中,做个爱分享的人。
干一件事,干好一件事!
QQ :1606588828
展开
-
01分布式数据仓库 HIVE -- 数据类型-文件格式
HIVE的数据类型包括基本,和复杂两种类型。 数据类型 所占字节 开始支持版本 TINYINT 1byte,-128 ~ 127 SMALLINT 2byte,-32,768 ~ 32,767 INT 4byte,-2,147,483,648 ~ 2,147,483,647原创 2014-12-19 21:00:05 · 637 阅读 · 0 评论 -
11分布式数据仓库 HIVE -- HIVE案例实战2 SLA
--========== order_created ==========-- /* 10703007267488 2014-05-01 06:01:12.334+01 10101043505096 2014-05-01 07:28:12.342+01 10103043509747 2014-05-01 07:50:12.33+01 10103043501575 2014-05-原创 2014-12-25 14:02:42 · 805 阅读 · 0 评论 -
08分布式数据仓库 HIVE -- UDF和UDAF
UDF(user defined function) 用于对每一条记录产生作用的自定义函数。 package hive; import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.io.Text; public class MyUDF extends UDF { private boolean ev原创 2014-12-24 08:40:42 · 771 阅读 · 0 评论 -
09分布式数据仓库 HIVE -- HIVE优化
HIVE执行流程 explain extended select city,count(1) from user group by city; //查看HQL对应的mapreduce流程树 1表的优化 1:表分区(例如:日志按天存放) 2:表分桶 2HQL优化 1: join优化 set hive.optimize.skewjoin=true;数据倾斜 se原创 2014-12-24 10:16:29 · 692 阅读 · 0 评论 -
07分布式数据仓库 HIVE -- 函数
HIVE函数,自带函数,和自定义函数 自带函数100多个包括,基本函数(map),聚合函数(reduce),集合函数(map),其他函数 自定义函数包括UDF(map) ,UDAF(reduce)。 -------------------------------------------------------------------------------------------------原创 2014-12-23 19:13:24 · 486 阅读 · 0 评论 -
05分布式数据仓库 HIVE -- 分区表的操作
创建分区 create table user( name string ) partitioned by (dt string,b string); 添加分区 alter table user add if not exists partition(dt='20140405',b='boy'); 删除分区 alter table user dro原创 2014-12-23 12:39:44 · 478 阅读 · 0 评论 -
03分布式数据仓库 HIVE -- 数据的相关操作
执行hive语句的方式 1:cli(command line interface) 2:jdbc 3:beeline 4:hwi 1 hive -命令(和hql执行有关) hive -V(-S) -e "select * from user" > /home/data; // -e 在linux下直接运行hql hive -f原创 2014-12-22 15:56:25 · 673 阅读 · 0 评论 -
06分布式数据仓库 HIVE -- 数据的查询(HQL Hive Query Language)
where查询 select * from user where name = ‘liguozhong’; where 操作是在多个map端进行的。 group by select name age count(1),avg(age),sum(money),count(distinct age) form user where sex = 'b' group by原创 2014-12-23 13:24:50 · 1027 阅读 · 0 评论 -
04分布式数据仓库 HIVE -- 导出分析结果
1 hadoop:get和text命令,整个表对应的文件都导出去。 2 insert overwrite local directory ‘/home/resultDir’ row format delimited fields terminated by '\t' select name,age from user where sex = 1;原创 2014-12-22 17:07:22 · 514 阅读 · 0 评论 -
02分布式数据仓库 HIVE -- 表的相关操作
建表 create table user(name string,password string); 简单建表 CREATE EXTERNAL TABLE SOGOUQ1(DT STRING,WEBSESSION STRING,WORD STRING,S_SEQ INT,C_SEQ INT,WEBSITE STRING) ROW FORMAT DELIMITED FIELDS TERMIN原创 2014-12-19 21:31:44 · 525 阅读 · 0 评论 -
10分布式数据仓库 HIVE -- HIVE案例实战1 apache common日志分析
1 日志分析场景 某网站的apache common每天产生一个日志日志文件。将每一天的日志文件,按照日期作为分期,导入HIVE数据仓库。通过hive分析网站用户行为,如:PV,注册数,UV ip 时间 访问地址原创 2014-12-24 16:07:53 · 1478 阅读 · 0 评论