我一直在尝试从数组集合中导出我需要的数据。所以简而言之,我在另一个数组中有十几个数组。所以基本结构如下:
id example (here I don't know exactly how many objects is inside of this array)
1 0
0 (here I don't know exactly how many objects is inside of this array)
result1
result2
result3
1
1
2
所以我想为此得到的就像下面的例子:
id A B C
1 [0].[0].result1.value [0].[0].result2.value [0].[0].result3.value
1 [0].[1].result1.value [0].[1].result2.value [0].[1].result3.value
....
我得到的唯一成就是通过使用这段代码,我删除了其中没有任何对象的初始数组:
select documentId,
CASE
WHEN size(currentPositions.phones) > 0 and cardinality(currentPositions.phones[0]) > 0
THEN currentPositions.phones
ELSE null
END AS only_with_phones
from prod_replication.person_record
limit 100