This may apply to Athena and or prestodb in general
array empty?
- Per stackoverflow learned the name for this in the docs is
cardinality
select cardinality(array[]) = 0;
- This cannot be applied to the output of a
json_extract(json_parse(data), '$.blah.flah.clah')
sincecardinality()
takesARRAY
and notJSON
. - 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.