Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 从JSON中提取负整数_Sql_Json_Presto_Json Extract_Trino - Fatal编程技术网

Sql 从JSON中提取负整数

Sql 从JSON中提取负整数,sql,json,presto,json-extract,trino,Sql,Json,Presto,Json Extract,Trino,但是,如果键值对的值中出现一个负整数,例如 {"foo":-12345, "bar": 12345} json_extract(json,$.foo')将返回NULL,但 json_extract(json,$.bar')将返回12345 json\u extract\u scalar也会产生相同的结果 在Presto中提取负整数的解决方法是什么 它在当前主机中按预期工作(Presto 320): presto:default> SELECT json_extract(JSON '{"f

但是,如果键值对的值中出现一个负整数,例如

{"foo":-12345, "bar": 12345}
json_extract(json,$.foo')
将返回NULL,但

json_extract(json,$.bar')
将返回12345

json\u extract\u scalar
也会产生相同的结果


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

它在当前
主机中按预期工作(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)