在 HIVE 中分解具有元素位置的结构数组

Explode an array of structs with element position in HIVE

有人知道是否有类似于 lateral view posexplode 但带有结构数组的东西吗?我想在计算元素的位置时将结构数组分解为多行。我使用 内联横向视图 进行爆炸,但它没有给出元素位置。

例如在数据中我有类似的东西: [{"group":A,"score":20},{"group":B,"score":30}]

我想看 table:

nb group score
1 A 20
2 B 30

使用横向视图 posexplode,然后使用点访问结构字段:

select t.*,
       e.pos, --position
       --struct fields
       e.st.group,
       e.st.score 
  from table_name t 
       lateral view outer posexplode (t.my_array_of_struct) e as pos, st