分区 通过partition by(字段名 字段类型) - 分区最后会形成一个目录。 分区的字段,不在源数据中出现,但是表的一部分 创建一个分区表 hive> create table stud01( id string, name string, age int ) partitioned by (grade string) row format delimited fields terminated by '\t'; 创建多级目录 hive> create table stud01( id string, name string, age int ) partitioned by (create_year string,create_month string) row format delimited fields terminated by '\t'; 导入数据 在导入数据时,通过partition提定分区的值: hive> load data local inpath '${env:HOME}/stud.txt' into table stud01 partition(grade='2009'); 查看分区 hive>show partitions stu01; 查询分区数据 select * from AccountRegister where create_date="2014-10-1";