hive运行map_values出错,Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: Error evaluating map_values(family_mem
例2 有以下格式的数据创建出合适的表结构,并将数据导入表中
1,小明,father:张三#mother:李丽#brother:小力,28
2,小华,father:李四#mother:吴姗#sister:小静,16
3,Aaron,father:Abbot#mother:Abby#brother:Abner,18
4,张启然,father:张雨勇#mother:蒋箐#sister:张业丽,21
5,马钰林,father:马洪思#mother:郑小涵#brother:马靖文,27
6,曾畅,father:曾文来#mother:房彤媛#sister:曾婉沁,21
7,韩文尧,father:韩石泉#mother:郑红珊#sister:韩妤,25
8,Dailey,father:Eddie#mother:Lacey#brother:Karla,18
1. 建表
create table t_family(id int,name string,family_mem map<string,string>,age int)
row format delimited
fields terminated by ','
collection items terminated by '#'
map keys terminated by ':'
;
解析:我们可以发现比较特殊的是家庭成员这里
father:张三#mother:李丽#brother:小力 ,
通过观察很容易就可以发现这是一个建对应一个值的kv形式,那么就可以选用map