array length in Athena

0

In Athena I've a column with an array(json), is there a way to calculate the length of that array for every row?

Paola
已提问 7 个月前1189 查看次数
2 回答
1
已接受的回答

Hi,

You can calculate the length of the array in Athena using the CARDINALITY function [1].
Here's the basic syntax:

SELECT CARDINALITY(json_column_name) AS array_length
FROM your_table_name;

Reference:
[1] https://docs.aws.amazon.com/athena/latest/ug/finding-lengths.html

Thanks,
Atul

profile picture
已回答 7 个月前
profile picture
专家
已审核 7 个月前
profile pictureAWS
专家
已审核 7 个月前
0

It works, thank you!

Paola
已回答 7 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容