HIVE資料匯入

2021-08-04 10:23:01 字數 1038 閱讀 4627

1. text資料檔案匯出text資料表中

資料格式:

建立相應的資料表

create table if not exists text_table(id int, count int) comment 'table desc' partitioned by (date int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile;

匯入資料

load data local inpath '/tmp/xgs/data.text' into table text_table partition (date=20170727);

2. orc資料檔案匯入orc資料表中

資料格式:

建立相應的資料表

create table if not exists orc_table(id int, count int) comment 'table desc' partitioned by (date int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as orcfile;

匯入資料

load data local inpath '/tmp/xgs/data.orc' into table orc_table partition (date=20170727);

3. orc與text互相匯入

主要是依靠insert關鍵字,如:insert into table orc_table partition (date=20170727) select id, count from text_table where date=20170727;

Hive資料匯入

1.操作準備資料來源 drop table if exists b create table b as select id,name,tel,age from b 2.複製檔案 如果資料檔案恰好是使用者需要的格式,那麼只需要複製檔案或資料夾就可以 hadoop fs cp source path t...

Hive 匯入匯出資料

將檔案中的資料載入到表中 load data local inpath examples files kv1.txt overwrite into table pokes 載入本地資料,同時給定分割槽資訊 load data local inpath examples files kv2.txt o...

hive資料匯入匯出

hive官方提供兩種匯入資料的方式 1 從表中匯入 insert overwrite table test select from test2 2 從檔案匯入 2.1 從本地檔案匯入 load data local inpath hadoop aa.txt overwrite into table ...