關於hive資料匯入方式的總結

2021-09-23 17:29:17 字數 1105 閱讀 3688

從本地匯入資料到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/inte***ce/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對應的目錄下。

hive 匯入資料的方式

load data local inpath linux filepath into table tablename 應用場景 常見的情況,一般用於日誌檔案的直接匯入 load data inpath hdfs filepath into table tablename 應用場景 本地資料儲存檔案比...

hive 匯入資料的方式

load data local inpath home hadoop data test1.txt into table test1 此處的檔案是從linux中的路徑中取的檔案插入到test1表中去的 load data inpath input test1.txt into table test1...

hive匯入資料的方式

load data local inpath filepath overwrite into table tablename partition partcol1 val1,partcol2 val2 解釋 local 可選,表示從本地檔案系統中載入,而非hdfs overwrite 可選,先刪除原...