关于hive数据导入方式的总结

    xiaoxiao2025-08-21  8

    从本地导入数据到hive: load data local inpath '/home/hive/tb_dw_cu_three_type_list_dtal/*.dat' overwrite into table csap.tb_dw_cu_three_type_list_dtal  partition(statis_date=20160121); 从HDFS直接导入数据到hive: load data inpath '/hadoop/interface/renaData/AOL_OPEN_CALL_LOG_*_201602_20160215.dat' into table csap.tb_ods_ct_rena_open_call_log_all_day partition(statis_date=20160215); 请注意load data inpath ‘/home/wyp/add.txt’ into table wyp;里面是没有local这个单词的,这个是和本地的区别。 从一个表中导数据到另一张表: insert into table test partition (age='25') select id, name, tel from wyp; hive支持多表插入: from wyp insert into table test partition(age) select id, name, tel, age insert into table test3 select id, name where age>25; 注意:传统数据块的形式insert into table values(字段1,字段2),这种形式hive是不支持的。 分区:在Hive中,表的每一个分区对应表下的相应目录,所有分区的数据都是存储在对应的目录中。 装载数据相当于把之前HDFS上的数据移动到hive对应的目录下。        
    最新回复(0)