aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/json/jsondocument
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-11-20 17:37:57 +0000
committerGitHub <noreply@github.com>2024-11-20 17:37:57 +0000
commitf76323e9b295c15751e51e3443aa47a36bee8023 (patch)
tree4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/sql/suites/json/jsondocument
parent753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff)
parenta7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff)
downloadydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/sql/suites/json/jsondocument')
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/input.txt2
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/input.txt.attr23
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/insert.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/insert.sql5
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/json_exists.sql10
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/json_query.sql10
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/json_value.sql10
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/select.cfg1
-rw-r--r--yql/essentials/tests/sql/suites/json/jsondocument/select.sql7
9 files changed, 70 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/input.txt b/yql/essentials/tests/sql/suites/json/jsondocument/input.txt
new file mode 100644
index 0000000000..0ded9367b7
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/input.txt
@@ -0,0 +1,2 @@
+{"Id"=123;"Profile"="{\"age\":30,\"name\":\"First name\"}"};
+{"Id"=456;"Profile"="{\"age\":52,\"name\":\"Second name\"}"}; \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/input.txt.attr b/yql/essentials/tests/sql/suites/json/jsondocument/input.txt.attr
new file mode 100644
index 0000000000..e61c1d4837
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/input.txt.attr
@@ -0,0 +1,23 @@
+{
+ "_yql_row_spec" = {
+ "Type" = [
+ "StructType";
+ [
+ [
+ "Id";
+ [
+ "DataType";
+ "Int64"
+ ]
+ ];
+ [
+ "Profile";
+ [
+ "DataType";
+ "JsonDocument"
+ ]
+ ]
+ ]
+ ]
+ }
+}
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/insert.cfg b/yql/essentials/tests/sql/suites/json/jsondocument/insert.cfg
new file mode 100644
index 0000000000..25c3682008
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/insert.cfg
@@ -0,0 +1,2 @@
+in Input jsondocument/input.txt
+out Output output.txt
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/insert.sql b/yql/essentials/tests/sql/suites/json/jsondocument/insert.sql
new file mode 100644
index 0000000000..a22fbb8390
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/insert.sql
@@ -0,0 +1,5 @@
+/* postgres can not */
+/* multirun can not */
+
+INSERT INTO plato.Output
+SELECT * FROM plato.Input;
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/json_exists.sql b/yql/essentials/tests/sql/suites/json/jsondocument/json_exists.sql
new file mode 100644
index 0000000000..9246bbf260
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/json_exists.sql
@@ -0,0 +1,10 @@
+/* syntax version 1 */
+/* postgres can not */
+
+$json = JsonDocument(@@{"a": {"b": 1}, "c": 2}@@);
+
+SELECT
+ JSON_EXISTS($json, "$.a"),
+ JSON_EXISTS($json, "$.b"),
+ JSON_EXISTS($json, "$.c"),
+ JSON_EXISTS(CAST(NULL as JsonDocument), "$.a"); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/json_query.sql b/yql/essentials/tests/sql/suites/json/jsondocument/json_query.sql
new file mode 100644
index 0000000000..24ac8dd2aa
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/json_query.sql
@@ -0,0 +1,10 @@
+/* syntax version 1 */
+/* postgres can not */
+
+$json = JsonDocument(@@{"a": {"b": 1}, "c": 2}@@);
+
+SELECT
+ JSON_QUERY($json, "$.a"),
+ JSON_QUERY($json, "$.b"),
+ JSON_QUERY($json, "$.c"),
+ JSON_QUERY(CAST(NULL as JsonDocument), "$.a"); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/json_value.sql b/yql/essentials/tests/sql/suites/json/jsondocument/json_value.sql
new file mode 100644
index 0000000000..ed807f569c
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/json_value.sql
@@ -0,0 +1,10 @@
+/* syntax version 1 */
+/* postgres can not */
+
+$json = JsonDocument(@@{"a": {"b": 1}, "c": 2}@@);
+
+SELECT
+ JSON_VALUE($json, "$.c"),
+ JSON_VALUE($json, "$.b"),
+ JSON_VALUE($json, "$.a"),
+ JSON_VALUE(CAST(NULL as JsonDocument), "$.a"); \ No newline at end of file
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/select.cfg b/yql/essentials/tests/sql/suites/json/jsondocument/select.cfg
new file mode 100644
index 0000000000..442a3ce787
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/select.cfg
@@ -0,0 +1 @@
+in Input jsondocument/input.txt
diff --git a/yql/essentials/tests/sql/suites/json/jsondocument/select.sql b/yql/essentials/tests/sql/suites/json/jsondocument/select.sql
new file mode 100644
index 0000000000..57361db5d1
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/json/jsondocument/select.sql
@@ -0,0 +1,7 @@
+/* postgres can not */
+
+SELECT
+ Id,
+ Profile
+FROM
+ plato.Input; \ No newline at end of file