summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/json2/test/cases/SqlTryExists.sql
blob: f42bd5628dbc7fbd03d2c408d2b6b83deea9ff6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
/* syntax version 1 */

$path = Json2::CompilePath("strict $.x");

-- Key exists
SELECT
    Json2::SqlTryExists(NULL, $path, AsDict()),
    Json2::SqlTryExists(CAST(@@{"x": 123}@@ as Json), $path, AsDict()),
    Json2::SqlTryExists(CAST(@@{"x": {"key": "value"}}@@ as Json), $path, AsDict()),
    Json2::SqlTryExists(CAST(@@{"x": [1, 2, 3]}@@ as Json), $path, AsDict()),
    Json2::SqlTryExists(CAST(@@{"x": null}@@ as Json), $path, AsDict());