一. Meta Store 使用mysql客户端登录hadoop100的mysql,可以看到库中多了一个metastore 现在尤其要关注这三个表 DBS表,存储的是Hive的数据库 TBLS表,存储的是Hive中的表,使用DB_ID和DBS表关联 COLUMNS_V2存储的是每个表中的字段信息 Meta Store并不存储真实的数据,只是存储数据库的元数据信息,数据是存储在HDFS上的 二. HDFS 浏览器打开 http://hadoop100:50070/explorer.html#/
hive中建立外部分区表,外部数据格式是json的如何导入呢? json格式的数据表不必含有分区字段,只需要在hdfs目录结构中体现出分区就可以了 This is all according to this guide: http://blog.cloudera.com/blog/2012/12/how-to-use-a-serde-in-apache-hive/ hive> ADD JAR /home/hadoop/hive-serdes-1.0-SNAPSHOT.jar; Added /ho
1. 同列多行数据组合成一个字段cell的方法, top N 问题的hive方案 如下: hive 列转行 to json与to array list set等复杂结构,hive topN的提取的窗口统计方法 select ll, collect_list(n) , -- 将topN 转换成 List or Json with the help of collect_set(xx) collect_list(xx) collect_list(nn), collect_list(ll), coll
select * from tbl where id=2 union select * from tbl where id =1 如果hive使用union这么查询的时候,我们会发现数据变乱了. 解决办法就是在select后边实际写上列名,就没有问题了,例如: select column1,column2 from tbl where id=2 union select column1,column2 from tbl where id =1
insert overwrite table store select t.p_key,t.sort_word from ( select p_key, sort_word , row_number()over(distribute by p_key sort by sort_word) as rn from store) t ; Hive上一个典型表内除重的写法, p_key为除重依据, sort_word 为排序依据,一般为时间 rn为排名. 这里就留下第一名 注意hql 方言中, 表的