Changeset: e00fdc31f1d3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e00fdc31f1d3
Added Files:
sql/test/nested/Tests/array-of-jdocs-list-format.json
sql/test/nested/Tests/array-of-jdocs-newline-format.json
sql/test/nested/Tests/array-of-jdocs.test.in
Branch: nested
Log Message:
Adds new test with array of docs
diffs (101 lines):
diff --git a/sql/test/nested/Tests/array-of-jdocs-list-format.json
b/sql/test/nested/Tests/array-of-jdocs-list-format.json
new file mode 100644
--- /dev/null
+++ b/sql/test/nested/Tests/array-of-jdocs-list-format.json
@@ -0,0 +1,10 @@
+[
+ [
+
{"name":"test_one","id":401,"actions":{"list":[{"elem":{"key":"ping","val":10}},{"elem":{"key":"pong","val":11}}]}},
+
{"name":"test_two","id":402,"actions":{"list":[{"elem":{"key":"tic","val":20}},{"elem":{"key":"tac","val":21}}]}}
+ ],
+ [
+
{"name":"test_three","id":403,"actions":{"list":[{"elem":{"key":"xy","val":30}},{"elem":{"key":"yz","val":31}}]}},
+
{"name":"test_four","id":404,"actions":{"list":[{"elem":{"key":"ab","val":40}},
{"elem":{"key":"bc","val":41}}]}}
+ ]
+]
diff --git a/sql/test/nested/Tests/array-of-jdocs-newline-format.json
b/sql/test/nested/Tests/array-of-jdocs-newline-format.json
new file mode 100644
--- /dev/null
+++ b/sql/test/nested/Tests/array-of-jdocs-newline-format.json
@@ -0,0 +1,2 @@
+[{"name":"test_five","id":405,"actions":{"list":[{"elem":{"key":"one","val":50}},{"elem":{"key":"two","val":51}}]}},{"name":"test_six","id":406,"actions":{"list":[{"elem":{"key":"hi","val":60}},{"elem":{"key":"low","val":61}}]}}]
+[{"name":"test_seven","id":407,"actions":{"list":[{"elem":{"key":"laag","val":70}},{"elem":{"key":"hoog","val":71}}]}},{"name":"test_seight","id":408,"actions":{"list":[{"elem":{"key":"ja","val":80}},{"elem":{"key":"nee","val":81}}]}}]
diff --git a/sql/test/nested/Tests/array-of-jdocs.test.in
b/sql/test/nested/Tests/array-of-jdocs.test.in
new file mode 100644
--- /dev/null
+++ b/sql/test/nested/Tests/array-of-jdocs.test.in
@@ -0,0 +1,74 @@
+
+statement ok
+create type elem_t as (key text, val int)
+
+statement ok
+create type list_obj_t as (elem elem_t)
+
+statement ok
+create type act_list as (list list_obj_t[])
+
+statement ok
+create type jdoc_t as (name text, id int, actions act_list)
+
+statement ok
+create table jdocs_arr (jda jdoc_t[])
+
+statement ok
+insert into jdocs_arr select json from
'$TSTSRCDIR/array-of-jdocs-list-format.json'
+
+statement ok
+insert into jdocs_arr select json from
read_ndjson('$TSTSRCDIR/array-of-jdocs-newline-format.json')
+
+query TIT nosort
+select jd.name, jd.id, ua.elem from jdocs_arr, unnest(jda) as jd,
unnest(jd.actions.list) as ua
+----
+test_one
+401
+("ping", 10)
+test_one
+401
+("pong", 11)
+test_two
+402
+("tic", 20)
+test_two
+402
+("tac", 21)
+test_three
+403
+("xy", 30)
+test_three
+403
+("yz", 31)
+test_four
+404
+("ab", 40)
+test_four
+404
+("bc", 41)
+test_five
+405
+("one", 50)
+test_five
+405
+("two", 51)
+test_six
+406
+("hi", 60)
+test_six
+406
+("low", 61)
+test_seven
+407
+("laag", 70)
+test_seven
+407
+("hoog", 71)
+test_seight
+408
+("ja", 80)
+test_seight
+408
+("nee", 81)
+
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]