spark-1.4.1(3)

Hadoop 2.6 + Hive 1.2.1 + spark-1.4.1(3)

限于喜欢 提交于 2019-12-04 06:36:45
1. 新建表 1) 新建表结构 create table user_table( id int, userid bigint, name string, describe string comment 'desc 表示用户的描述 ' ) comment ' 这是用户信息表 ' partitioned by(country string, city string) -- 建立分区,所谓的分区就是文件夹 clustered by (id) sorted by (userid) into 32 buckets // 通过 id 进行 hash 取值来分桶,桶类通过 userid 来排序排序 分桶便于有用数据加载到 有限的 内存中 (性能上的优化 ---- 还有 join,group by,distinct ) row format delimited -- 指定分隔符解析数据 fields terminated by '\001' -- 字段之间的分隔符 collection items terminated by '\002' -- array 字段内部的分隔符 map keys terminated by '\003' -- map 字段内部分隔符 // 用来分隔符解析数据( load 进去的原始数据, hive 是不会对它进行任何处理) stored as textfile; --