Snowflake如何容纳不可解析的JSON行



假设这个查询

select gestimate, (get(parse_json(gestimate) :duration,'value')) / 60.0  AS rc_estimate 
from mytable;

会爆炸,因为在120M行中,有一个不可解析的行。如何调整这个查询,所以它放置一个0到rc_estimate,如果它是不可解析的?

Using TRY_PARSE_JSON:

select gestimate, (get(try_parse_json(gestimate) :duration,'value')) / 60.0  AS rc_estimate 
from mytable;

COALESCE(expr, 0), ZEROIFNULL(expr)可用于将结果从NULL更改为0。

最新更新