Import local data imported hive
. Load data local inpath '/root/tes.txt' into table database tables;
Hdfs into the cluster hive
. Load data inpath 'hdfs: // node01: 9000 / user / tes.txt' into table database tables;
HIve partition table (static partitions, dynamic partitioning)
Static partition:
必须在表定义时指定对应的partition字段-----分区字段一定不能与表中字段重复
1. build a single partition table
Single-partition table to add data
Similar multi-partition:
create table hour(id int, content string) partitioned by (dt int, hour int);
When viewed in hdfs partition is present in the form of a folder. In the form of multi-partition will be similar / dt / hour folders
Increase the number of partitions is
alter table hour add partition(dt=10,hour=40);
Delete partitions is
alter table tablename drop partition (sex=‘boy’)
Dynamic partitioning: automatically after a simple partition data more
Now /conf/hive-site.xml you need to add configuration
After configuration is complete
Adding data partitions can also be used after the dynamic
from a // table data have already present and
insert overwrite table b partiton (age, sex) overwrite overwrite the data in the table is added into the data
select * distribute by age, sex
Hive sub-barrel table
In the above table have been sub-divided barrel barrels opened up, which can be used directly in
Create a sub-bucket table
adding data
insert into table b select id,name from a
According to sub-barrel inside the barrel to find data
Author: Heart 1.5 billion girls
Source: CSDN
Original: https://blog.csdn.net/sksea99/article/details/93121479
Copyright: This article is a blogger original article, reproduced, please attach Bowen link!