Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 Presto 相当陌生,并且正在尝试解析一堆包含 JSON 数据的记录。似乎某些数据无效,这导致 Presto 在调用json_parse. 在这种情况下,是否有可能以某种方式返回 NULL 而不是抛出错误?
json_parse
以前您似乎可以使用try_cast(value as json),但已将其删除以支持json_parse. 我可以更改任何配置来解决此问题,还是我需要求助于创建自定义 SerDe?
try_cast(value as json)
看起来json_extract(data, '$')会为无效的 JSON 返回 NULL:
json_extract(data, '$')
presto:default> select json_extract('{', '$'); _col0 ------- NULL (1 row)