Checking array in Athena

dunstantom picture dunstantom · Apr 12, 2017 · Viewed 8.3k times · Source

I have a table in Athena where one of the columns is of type array<string>. However, when I run

select * from mytable
where array_contains(myarr,'foobar')
limit 10

it seems Athena doesn't have the array_contains function:

SYNTAX_ERROR: line 2:7: Function array_contains not registered

Is there an alternative way to check if the array contains a particular string?

Answer

David דודו Markovitz picture David דודו Markovitz · Apr 13, 2017
select * 
from   mytable
where  contains(myarr,'foobar')
limit  10