从 JSON 中提取负整数

Extract negative integers from JSON

我使用的是PrestoSQL中的json_extract函数,但是,如果键值对中出现负整数的值如

{"foo":-12345, "bar": 12345}

json_extract(json, '$.foo') 将 return NULL 但

json_extract(json, '$.bar') 将 return 12345

json_extract_scalar 也产生相同的结果。

在 Presto 中提取负整数的解决方法是什么?

它在当前 master (Presto 320) 中按预期工作:

presto:default> SELECT json_extract(JSON '{"foo":-12345, "bar": 12345}', '$.foo');
 _col0
--------
 -12345
(1 row)
presto:default> SELECT json_extract_scalar(JSON '{"foo":-12345, "bar": 12345}', '$.foo');
 _col0
--------
 -12345
(1 row)