This may apply to Athena and or prestodb in general

array empty?

select cardinality(array[]) = 0;
  • This cannot be applied to the output of a json_extract(json_parse(data), '$.blah.flah.clah') since cardinality() takes ARRAY and not JSON.
  • However, that JSON can be cast. For example, if '$.blah.flah.clah' is like [{"hi": "there"}, {"so": "then"}], then this
cardinality(cast(json_extract(json_parse(what), '$.blah.flah.clah') as array(map(varchar, varchar))))

will produce the length of those arrays.