Files
greptimedb/tests/cases/standalone/common/function/json/json.result
Yohan Wal 288fdc3145 feat: json_path_exists udf (#4807)
* feat: json_path_exists udf

* chore: fix comments

* fix: caution when copy&paste QAQ
2024-10-10 14:15:34 +00:00

34 lines
1.6 KiB
Plaintext

--- json_path_exists ---
SELECT json_path_exists(parse_json('{"a": 1, "b": 2}'), '$.a');
+--------------------------------------------------------------------+
| json_path_exists(parse_json(Utf8("{"a": 1, "b": 2}")),Utf8("$.a")) |
+--------------------------------------------------------------------+
| true |
+--------------------------------------------------------------------+
SELECT json_path_exists(parse_json('{"a": 1, "b": 2}'), '$.c');
+--------------------------------------------------------------------+
| json_path_exists(parse_json(Utf8("{"a": 1, "b": 2}")),Utf8("$.c")) |
+--------------------------------------------------------------------+
| false |
+--------------------------------------------------------------------+
SELECT json_path_exists(parse_json('[1, 2]'), '[0]');
+----------------------------------------------------------+
| json_path_exists(parse_json(Utf8("[1, 2]")),Utf8("[0]")) |
+----------------------------------------------------------+
| true |
+----------------------------------------------------------+
SELECT json_path_exists(parse_json('[1, 2]'), '[2]');
+----------------------------------------------------------+
| json_path_exists(parse_json(Utf8("[1, 2]")),Utf8("[2]")) |
+----------------------------------------------------------+
| false |
+----------------------------------------------------------+