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달 전1190회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠