[英]BigQuery - Extract first non-null value from JSON collection
考虑以下方法
create temp function values(input string) returns array<string> language js as """
return Object.values(JSON.parse(input));
""";
select my_collection,
( select val
from unnest(values(my_collection)) val with offset
where not val is null
order by offset
limit 1
) as first_not_null_value
from your_table
如果应用于您问题中的示例数据 - output 是
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.