Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hive 如何在配置单元中分解贴图数组_Hive_Hiveql - Fatal编程技术网

Hive 如何在配置单元中分解贴图数组

Hive 如何在配置单元中分解贴图数组,hive,hiveql,Hive,Hiveql,考虑一个具有以下结构的表my_table: >> describe my_table id bigint info_detail map<bigint,array<string>> 如何分解细节,因此结果如下所示: info_id detail 112344 "something about 112344" 112344 "other things" 342302 "somethi

考虑一个具有以下结构的表
my_table

>> describe my_table

id               bigint
info_detail      map<bigint,array<string>>
如何分解
细节
,因此结果如下所示:

   info_id  detail
   112344   "something about 112344"
   112344   "other things"
   342302   "something about 342302"

您必须将
分解
两次,一次在
映射
列上,然后在其中生成的
数组

select tbl.info_id,tbl1.details
from my_table m
lateral view explode(info_detail) tbl as info_id,detail 
lateral view explode(detail) tbl1 as details

您应该能够在分解贴图后分解数组,如下所示

select info_id, d from (
select explode(info_detail) as (info_id, detail) 
from my_table
) t lateral view explode(detail) detailexploded as d;

编译语句时,
Error:FAILED:SemanticException[Error 10081]:在SELECT子句之外不支持UDTF,在表达式中也不支持UDTF,而不是在数组中进行分解,因此在第一次分解之后添加UDTF似乎有效:
横向视图分解(细节)按细节进行测试这是一种干净的解决方案
select info_id, d from (
select explode(info_detail) as (info_id, detail) 
from my_table
) t lateral view explode(detail) detailexploded as d;