HIVE运行出错分析

本文介绍了如何在Hive中处理KV格式的数据,包括如何创建合适的表结构和导入数据。在处理过程中遇到map_values函数出错的问题,分析了错误原因并提出了解决方案。同时,分享了如何查询map类型字段的键、值以及如何查找和使用Hive内置函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值