hive 匯入資料的方式

2021-09-28 04:57:02 字數 914 閱讀 3065

load

data

local inpath '/home/hadoop/data/test1.txt'

into

table test1;

此處的檔案是從linux中的路徑中取的檔案插入到test1表中去的

load

data inpath '/input/test1.txt'

into

table test1;

此處的檔案是從hdfs中取的檔案

insert

into

table test1 select

*from test2;

此時test2的字段數、資料型別都要與test1相同

insert overwrite into

table t1 partition

(day

='20190101'

)select id,name,

date

,salary from t2 where

day=

'20190101'

這裡由於表有分割槽,不能直接select * ,會報字段不匹配。

load

data inpath '/input/test1.txt' overwrite into

table test1;

overwrite的作用就是將test1表在匯入資料的時候進行覆蓋操作(先刪除原先表中的資料,之後將檔案中的資料匯入到表中)

hive 匯入資料的方式

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

hive匯入資料的方式

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

HIVE匯入資料的方式

load data local inpath 資料在本地位置 into table table name 2.loadhdfs資料 增量匯入資料 在原來的資料後追加 load data inpath 資料在hdfs中的位置 into table table name 全量匯入資料 會覆蓋掉原本的資料...