Hive数据库和表 在HDFS上的目录, 表数据是HDFS上的文件
加载本地文件到Hive表中
--使用存储介质(移动硬盘)
加载数据到表格中
load data
local
inpath '/home/taojiamin/data/student.txt' into table student;
加载HDFS文件到Hive表中
--通过Flume等日志收集框架
仅仅是没有local而已,特点:加载hdfs数据时,实际上进行的是
剪切
和
移动
操作. 该策略是节约HDFS空间考虑的
load data inpath '/home/taojiamin/data/student.txt' into table student;
加载数据,覆盖表中已有的数据
load data [local] inpth '文件'
overwrite
into table;
创建表时 通过select 加载
create table tableB row format delimited filelds termianted by ','
as
select * from tableA;
创建表时 通过insert 加载
insert into
table table_namea select * fom tableB;
创建表时 通过location 指定 加载
create extrnal table_name(
col1_name col1_type,
...
coln_name coln_type
)
row format delimited fields terminated by '\t';
location 'HDFS上的目录'