load加载".txt"文件数据到表“table1”
HIVE建表结构
一、数据
1,tom,music-running-code,c++:98.0-java:76.0-php:65.0 2,jerry,music-code,c++:93.0-java:70.0-php:55.0 3,john,code,go:87.0-python:93.0
二、建表语句
CREATE TABLE table1 ( id int, name string, interest array<string>, score map<string,string> ) row format delimited fields terminated by ',' --列分割 collection items terminated by '-' --array分割 map keys terminated by ':' --map分割 stored AS textfile; --保存
三、导入数据
load data local inpath '/opt/data/test' overwrite into table table1;
create table table1( id int,name string, interest array<string>, score map<string,string>) row format delimited fields terminated by ',' collection items terminated by '-' map keys terminated by ':' stored as textfile; load data local inpath '/root/testdata.txt' overwrite into table table1;