Map使用
建表:
[plain] view plaincopy
hive> create table employee(id string, perf map
> ROW FORMAT DELIMITED
> FIELDS TERMINATED BY "\t"
> COLLECTION ITEMS TERMINATED BY ","
> MAP KEYS TERMINATED BY ":";
OK
Time taken: 0.144 seconds
‘MAP KEYS TERMINATED BY’ :key value分隔符
匯入資料:
$ cat test7.txt
1 job:80,team:60,person:70
2 job:60,team:80
3 job:90,team:70,person:100
hive> LOAD DATA LOCAL INPATH "/home/work/data/test7.txt" INTO TABLE employee;
Map使用
建表:
[plain] view plaincopy
hive> create table employee(id string, perf map
> ROW FORMAT DELIMITED
> FIELDS TERMINATED BY "\t"
> COLLECTION ITEMS TERMINATED BY ","
> MAP KEYS TERMINATED BY ":";
OK
Time taken: 0.144 seconds
‘MAP KEYS TERMINATED BY’ :key value分隔符
匯入資料:
[plain] view plaincopy
$ cat test7.txt
1 job:80,team:60,person:70
2 job:60,team:80
3 job:90,team:70,person:100
hive> LOAD DATA LOCAL INPATH "/home/work/data/test7.txt" INTO TABLE employee;