diff options
author | robot-piglet <[email protected]> | 2024-12-26 13:15:14 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2024-12-26 13:36:50 +0300 |
commit | 98b351241c7fb7ee4caff0ee09598e54bec59fe5 (patch) | |
tree | 0f2f0af87d6b86821731825bbb1ee51c8cc1a96c /yql/essentials/tests/sql/suites/json/json_value | |
parent | 179a188c92e62f168719f4bb4bb9a8a464fb3d80 (diff) |
Intermediate changes
commit_hash:d6e69042088451340ac37dd3d928f2cb483a54e9
Diffstat (limited to 'yql/essentials/tests/sql/suites/json/json_value')
16 files changed, 0 insertions, 119 deletions
diff --git a/yql/essentials/tests/sql/suites/json/json_value/example.cfg b/yql/essentials/tests/sql/suites/json/json_value/example.cfg deleted file mode 100644 index d23c2d6847b..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/example.cfg +++ /dev/null @@ -1 +0,0 @@ -in T example.txt
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/example.sql b/yql/essentials/tests/sql/suites/json/json_value/example.sql deleted file mode 100644 index b62ed6648bc..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/example.sql +++ /dev/null @@ -1,55 +0,0 @@ -/* syntax version 1 */ -/* postgres can not */ -USE plato; - --- These examples are taken from [ISO/IEC TR 19075-6:2017] standard (https://www.iso.org/standard/67367.html) -SELECT T.K, - JSON_VALUE (T.J, 'lax $.who') AS Who -FROM T; - -SELECT T.K, - JSON_VALUE (T.J, 'lax $.who') AS Who, - JSON_VALUE (T.J, 'lax $.where' - NULL ON EMPTY) AS Nali -FROM T; - -SELECT T.K, - JSON_VALUE (T.J, 'strict $.who') AS Who, - JSON_VALUE (T.J, 'strict $.where' - DEFAULT 'no where there' ON ERROR ) - AS Nali -FROM T; - -SELECT T.K, - JSON_VALUE (T.J, 'lax $.who') AS Who, - JSON_VALUE (T.J, 'lax $.where' NULL ON EMPTY) AS Nali, - JSON_VALUE (T.J, 'lax $.friends.name' NULL ON EMPTY - DEFAULT '*** error ***' ON ERROR) - AS Friend -FROM T; - -SELECT T.K, - JSON_VALUE (T.J, 'strict $.who') AS Who, - JSON_VALUE (T.J, 'strict $.where' NULL ON EMPTY NULL ON ERROR) AS Nali, - - -- NOTE: output for this particular column differs with standard. - -- For row with T.K = 106 and T.J = { "who": "Louise", "where": "Iana" } output is "*** error ***", not NULL. - -- This is because answer in standard (NULL) is not correct. Query "strict $.friends[*].name" is executed in strict mode - -- where all structural errors are "hard" errors. Row with T.K = 106 does not have "friends" key in T.J. This is structural error - -- and the result of JSON_VALUE must tolerate ON ERROR section which specifies to return "*** error ***" string. - -- - -- We can check this in PostgreSQL too (at the moment of writing PostgreSQL does not support JSON_VALUE function so we use jsonb_path_query): - -- postgres=# select * from jsonb_path_query('{ "who": "Louise", "where": "Iana" }', 'strict $.friends[*].name'); - -- ERROR: JSON object does not contain key "friends" - -- PostgreSQL shows us that hard error has happened, as expected. - JSON_VALUE (T.J, 'strict $.friends[*].name' NULL ON EMPTY - DEFAULT '*** error ***' ON ERROR) - AS Friend -FROM T; - -SELECT T.K, - JSON_VALUE (T.J, 'lax $.who') AS Who, - -- NOTE: In the original example INTEGER type was used. YQL does not have INTEGER type, Int64 was used instead - JSON_VALUE (T.J, 'lax $.friends[0].rank' RETURNING Int64 NULL ON EMPTY) - AS Rank -FROM T; diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_empty_cast_default_exception.cfg b/yql/essentials/tests/sql/suites/json/json_value/on_empty_cast_default_exception.cfg deleted file mode 100644 index eb2e5315d1e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_empty_cast_default_exception.cfg +++ /dev/null @@ -1 +0,0 @@ -xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_empty_cast_default_exception.sql b/yql/essentials/tests/sql/suites/json/json_value/on_empty_cast_default_exception.sql deleted file mode 100644 index 8237aef3380..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_empty_cast_default_exception.sql +++ /dev/null @@ -1,5 +0,0 @@ -/* custom error:Failed to cast default value from ON EMPTY clause to target type Optional<Uint32>*/ - -$json = CAST("{}" as Json); -SELECT - JSON_VALUE($json, "lax $.key" RETURNING Uint32 DEFAULT -2 ON EMPTY ERROR ON ERROR); diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_empty_exception.cfg b/yql/essentials/tests/sql/suites/json/json_value/on_empty_exception.cfg deleted file mode 100644 index eb2e5315d1e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_empty_exception.cfg +++ /dev/null @@ -1 +0,0 @@ -xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_empty_exception.sql b/yql/essentials/tests/sql/suites/json/json_value/on_empty_exception.sql deleted file mode 100644 index d30d3161b0c..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_empty_exception.sql +++ /dev/null @@ -1,5 +0,0 @@ -/* custom error:Result is empty*/ - -$json = CAST("{}" as Json); -SELECT - JSON_VALUE($json, "lax $.key" ERROR ON EMPTY); diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_default_exception.cfg b/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_default_exception.cfg deleted file mode 100644 index eb2e5315d1e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_default_exception.cfg +++ /dev/null @@ -1 +0,0 @@ -xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_default_exception.sql b/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_default_exception.sql deleted file mode 100644 index a7169032d9f..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_default_exception.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* custom error:Failed to cast default value from ON ERROR clause to target type Optional<Uint16>*/ - --- Here JsonPath engine returns error result and ON ERROR section must be used. --- But default value in ON ERROR section is -123 and casting it to Uint16 will fail. --- In this case exception must be raised. -$json = CAST("{}" as Json); -SELECT - JSON_VALUE($json, "strict $.key" RETURNING Uint16 DEFAULT -123 ON ERROR); diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_udf_exception.cfg b/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_udf_exception.cfg deleted file mode 100644 index eb2e5315d1e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_udf_exception.cfg +++ /dev/null @@ -1 +0,0 @@ -xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_udf_exception.sql b/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_udf_exception.sql deleted file mode 100644 index a3fb807857c..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_udf_exception.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* custom error:Cannot convert extracted JSON value to target type*/ - --- In this case call to Json2::SqlValueNumber will fail because "string" --- does not represent Number value -$json = CAST(@@{ - "key": "string" -}@@ as Json); -SELECT - JSON_VALUE($json, "strict $.key" RETURNING Uint16 ERROR ON ERROR); diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_value_exception.cfg b/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_value_exception.cfg deleted file mode 100644 index eb2e5315d1e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_value_exception.cfg +++ /dev/null @@ -1 +0,0 @@ -xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_value_exception.sql b/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_value_exception.sql deleted file mode 100644 index a671f89fca1..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_cast_value_exception.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* custom error:Failed to cast extracted JSON value to target type Optional<Uint16>*/ - --- In this case call to Json2::SqlValueNumber will be successfull, but cast --- of -123 to Uint16 will fail -$json = CAST(@@{ - "key": -123 -}@@ as Json); -SELECT - JSON_VALUE($json, "strict $.key" RETURNING Uint16 ERROR ON ERROR); diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_jsonpath_exception.cfg b/yql/essentials/tests/sql/suites/json/json_value/on_error_jsonpath_exception.cfg deleted file mode 100644 index eb2e5315d1e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_jsonpath_exception.cfg +++ /dev/null @@ -1 +0,0 @@ -xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/on_error_jsonpath_exception.sql b/yql/essentials/tests/sql/suites/json/json_value/on_error_jsonpath_exception.sql deleted file mode 100644 index ee4467e138e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/on_error_jsonpath_exception.sql +++ /dev/null @@ -1,5 +0,0 @@ -/* custom error:Member not found*/ - -$json = CAST("{}" as Json); -SELECT - JSON_VALUE($json, "strict $.key" ERROR ON ERROR); diff --git a/yql/essentials/tests/sql/suites/json/json_value/passing_exception.cfg b/yql/essentials/tests/sql/suites/json/json_value/passing_exception.cfg deleted file mode 100644 index eb2e5315d1e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/passing_exception.cfg +++ /dev/null @@ -1 +0,0 @@ -xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/json/json_value/passing_exception.sql b/yql/essentials/tests/sql/suites/json/json_value/passing_exception.sql deleted file mode 100644 index 2c6dfcf9b9e..00000000000 --- a/yql/essentials/tests/sql/suites/json/json_value/passing_exception.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* syntax version 1 */ -/* postgres can not */ -/* custom error:Expected data or optional of data, but got: Tuple<Int32,Int32>*/ - -$json = CAST(@@{ - "key": 123 -}@@ as Json); - --- Tuple type is not supported for variables -SELECT - JSON_VALUE( - $json, "strict $var" - PASSING - AsTuple(1, 2) as var - ); |