Changeset: 6833bdb451f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6833bdb451f9
Modified Files:
        clients/Tests/exports.stable.out
Branch: monetdburl
Log Message:

merged with default


diffs (truncated from 2186 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1145,7 +1145,6 @@ InstrPtr pushArgumentId(MalBlkPtr mb, In
 InstrPtr pushBit(MalBlkPtr mb, InstrPtr q, bit val);
 InstrPtr pushBte(MalBlkPtr mb, InstrPtr q, bte val);
 InstrPtr pushDbl(MalBlkPtr mb, InstrPtr q, dbl val);
-InstrPtr pushEmptyBAT(MalBlkPtr mb, InstrPtr q, int tpe);
 InstrPtr pushEndInstruction(MalBlkPtr mb);
 InstrPtr pushFlt(MalBlkPtr mb, InstrPtr q, flt val);
 InstrPtr pushHge(MalBlkPtr mb, InstrPtr q, hge val);
diff --git a/clients/examples/C/bincopydata.c b/clients/examples/C/bincopydata.c
--- a/clients/examples/C/bincopydata.c
+++ b/clients/examples/C/bincopydata.c
@@ -265,7 +265,7 @@ gen_json(FILE *f, bool byteswap, long nr
                if (i % 100 == 99) {
                        fputc('\x80', f);
                } else {
-                       fprintf(f, "{\"id\": %ld, \"msg\":\n\"int%ld\"}", i, i);
+                       fprintf(f, "{\"id\":%ld,\"msg\":\"int%ld\"}", i, i);
                }
                fputc('\0', f);
        }
diff --git a/monetdb5/ChangeLog.json-storage b/monetdb5/ChangeLog.json-storage
new file mode 100644
--- /dev/null
+++ b/monetdb5/ChangeLog.json-storage
@@ -0,0 +1,10 @@
+# ChangeLog file for monetdb5
+# This file is updated with Maddlog
+
+* Fri Oct 20 2023 Panagiotis Koutsourakis <[email protected]>
+- Change how json is stored in the database: We now normalize json
+  strings after parsing, removing whitespace and eliminating duplicate
+  keys in objects.
+- The function json.filter now properly returns json scalars instead of
+  wrapping them in an array.
+
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -698,20 +698,6 @@ pushZero(MalBlkPtr mb, InstrPtr q, int t
 }
 
 InstrPtr
-pushEmptyBAT(MalBlkPtr mb, InstrPtr q, int tpe)
-{
-       if (q == NULL || mb->errors)
-               return q;
-       setModuleId(q, getName("bat"));
-       setFunctionId(q, getName("new"));
-
-       q = pushArgument(mb, q, newTypeVariable(mb, TYPE_void));
-       q = pushArgument(mb, q, newTypeVariable(mb, getBatType(tpe)));
-       q = pushZero(mb, q, TYPE_lng);
-       return q;
-}
-
-InstrPtr
 pushValue(MalBlkPtr mb, InstrPtr q, ValPtr vr)
 {
        int _t;
diff --git a/monetdb5/mal/mal_builder.h b/monetdb5/mal/mal_builder.h
--- a/monetdb5/mal/mal_builder.h
+++ b/monetdb5/mal/mal_builder.h
@@ -50,7 +50,6 @@ mal_export InstrPtr pushNil(MalBlkPtr mb
 mal_export InstrPtr pushType(MalBlkPtr mb, InstrPtr q, int tpe);
 mal_export InstrPtr pushNilType(MalBlkPtr mb, InstrPtr q, char *tpe);
 mal_export InstrPtr pushZero(MalBlkPtr mb, InstrPtr q, int tpe);
-mal_export InstrPtr pushEmptyBAT(MalBlkPtr mb, InstrPtr q, int tpe);
 mal_export InstrPtr pushValue(MalBlkPtr mb, InstrPtr q, ValPtr cst);
 
 mal_export int getIntConstant(MalBlkPtr mb, int val);
diff --git a/monetdb5/modules/atoms/Tests/json03.maltest 
b/monetdb5/modules/atoms/Tests/json03.maltest
--- a/monetdb5/modules/atoms/Tests/json03.maltest
+++ b/monetdb5/modules/atoms/Tests/json03.maltest
@@ -65,7 +65,7 @@ js:= calc.json("[{ \"category\": \"refer
 query T rowsort
 io.print(js)
 ----
-"[{ \"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": 
\"Sayings of the Century\", \"price\": 8.95 }, { \"category\": \"fiction\", 
\"author\": \"Evelyn Waugh\", \"title\": \"Sword of Honour\", \"price\": 12.99 
}, { \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": 
\"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 }, { \"category\": 
\"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": \"The Lord of the 
Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 }, { \"color\": \"red\", 
\"price\": 19.95 }]"
+"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of 
the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn 
Waugh\",\"title\":\"Sword of 
Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman 
Melville\",\"title\":\"Moby 
Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J.
 R. R. Tolkien\",\"title\":\"The Lord of the 
Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99},{\"color\":\"red\",\"price\":19.95}]"
 
 statement ok
 (k,v):= json.unfold(js)
@@ -75,19 +75,19 @@ io.print(k,v)
 ----
 0
 NULL
-{ "category": "reference", "author": "Nigel Rees", "title": "Sayings of the 
Century", "price": 8.95 }
+{"category":"reference","author":"Nigel Rees","title":"Sayings of the 
Century","price":8.95}
 1
 NULL
-{ "category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", 
"price": 12.99 }
+{"category":"fiction","author":"Evelyn Waugh","title":"Sword of 
Honour","price":12.99}
 2
 NULL
-{ "category": "fiction", "author": "Herman Melville", "title": "Moby Dick", 
"isbn": "0-553-21311-3", "price": 8.99 }
+{"category":"fiction","author":"Herman Melville","title":"Moby 
Dick","isbn":"0-553-21311-3","price":8.99}
 3
 NULL
-{ "category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of 
the Rings", "isbn": "0-395-19395-8", "price": 22.99 }
+{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the 
Rings","isbn":"0-395-19395-8","price":22.99}
 4
 NULL
-{ "color": "red", "price": 19.95 }
+{"color":"red","price":19.95}
 
 statement ok
 jsn:= json.fold(k,v)
@@ -95,7 +95,7 @@ jsn:= json.fold(k,v)
 query T rowsort
 io.print(jsn)
 ----
-"[{ \"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": 
\"Sayings of the Century\", \"price\": 8.95 },{ \"category\": \"fiction\", 
\"author\": \"Evelyn Waugh\", \"title\": \"Sword of Honour\", \"price\": 12.99 
},{ \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": 
\"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 },{ \"category\": 
\"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": \"The Lord of the 
Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 },{ \"color\": \"red\", 
\"price\": 19.95 }]"
+"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of 
the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn 
Waugh\",\"title\":\"Sword of 
Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman 
Melville\",\"title\":\"Moby 
Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J.
 R. R. Tolkien\",\"title\":\"The Lord of the 
Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99},{\"color\":\"red\",\"price\":19.95}]"
 
 statement ok
 (o,l,w):= json.unfold(js)
@@ -106,23 +106,23 @@ io.print(o,l,w)
 0
 0
 NULL
-{ "category": "reference", "author": "Nigel Rees", "title": "Sayings of the 
Century", "price": 8.95 }
+{"category":"reference","author":"Nigel Rees","title":"Sayings of the 
Century","price":8.95}
 1
 1
 NULL
-{ "category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", 
"price": 12.99 }
+{"category":"fiction","author":"Evelyn Waugh","title":"Sword of 
Honour","price":12.99}
 2
 2
 NULL
-{ "category": "fiction", "author": "Herman Melville", "title": "Moby Dick", 
"isbn": "0-553-21311-3", "price": 8.99 }
+{"category":"fiction","author":"Herman Melville","title":"Moby 
Dick","isbn":"0-553-21311-3","price":8.99}
 3
 3
 NULL
-{ "category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of 
the Rings", "isbn": "0-395-19395-8", "price": 22.99 }
+{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the 
Rings","isbn":"0-395-19395-8","price":22.99}
 4
 4
 NULL
-{ "color": "red", "price": 19.95 }
+{"color":"red","price":19.95}
 
 statement ok
 jsm:= json.fold(o,l,w)
@@ -130,7 +130,7 @@ jsm:= json.fold(o,l,w)
 query T rowsort
 io.print(jsm)
 ----
-"[{ \"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": 
\"Sayings of the Century\", \"price\": 8.95 },, { \"category\": \"fiction\", 
\"author\": \"Evelyn Waugh\", \"title\": \"Sword of Honour\", \"price\": 12.99 
},, { \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": 
\"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 },, { \"category\": 
\"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": \"The Lord of the 
Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 },, { \"color\": 
\"red\", \"price\": 19.95 }]"
+"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of 
the Century\",\"price\":8.95},, {\"category\":\"fiction\",\"author\":\"Evelyn 
Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99},, 
{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby 
Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},, 
{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord 
of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99},, 
{\"color\":\"red\",\"price\":19.95}]"
 
 statement ok
 b:= bat.new(:int)
diff --git a/monetdb5/modules/atoms/Tests/json04.maltest 
b/monetdb5/modules/atoms/Tests/json04.maltest
--- a/monetdb5/modules/atoms/Tests/json04.maltest
+++ b/monetdb5/modules/atoms/Tests/json04.maltest
@@ -4,7 +4,7 @@ js:= calc.json("[{ \"category\": \"refer
 query T rowsort
 io.print(js)
 ----
-"[{ \"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": 
\"Sayings of the Century\", \"price\": 8.95 }, { \"category\": \"fiction\", 
\"author\": \"Evelyn Waugh\", \"title\": \"Sword of Honour\", \"price\": 12.99 
}, { \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": 
\"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 }, { \"category\": 
\"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": \"The Lord of the 
Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 }, { \"color\": \"red\", 
\"price\": 19.95 }]"
+"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of 
the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn 
Waugh\",\"title\":\"Sword of 
Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman 
Melville\",\"title\":\"Moby 
Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J.
 R. R. Tolkien\",\"title\":\"The Lord of the 
Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99},{\"color\":\"red\",\"price\":19.95}]"
 
 statement ok
 (k,v):= json.unfold(js)
@@ -14,19 +14,19 @@ io.print(k,v)
 ----
 0
 NULL
-{ "category": "reference", "author": "Nigel Rees", "title": "Sayings of the 
Century", "price": 8.95 }
+{"category":"reference","author":"Nigel Rees","title":"Sayings of the 
Century","price":8.95}
 1
 NULL
-{ "category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", 
"price": 12.99 }
+{"category":"fiction","author":"Evelyn Waugh","title":"Sword of 
Honour","price":12.99}
 2
 NULL
-{ "category": "fiction", "author": "Herman Melville", "title": "Moby Dick", 
"isbn": "0-553-21311-3", "price": 8.99 }
+{"category":"fiction","author":"Herman Melville","title":"Moby 
Dick","isbn":"0-553-21311-3","price":8.99}
 3
 NULL
-{ "category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of 
the Rings", "isbn": "0-395-19395-8", "price": 22.99 }
+{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the 
Rings","isbn":"0-395-19395-8","price":22.99}
 4
 NULL
-{ "color": "red", "price": 19.95 }
+{"color":"red","price":19.95}
 
 statement ok
 jsn:= json.fold(k,v)
@@ -34,7 +34,7 @@ jsn:= json.fold(k,v)
 query T rowsort
 io.print(jsn)
 ----
-"[{ \"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": 
\"Sayings of the Century\", \"price\": 8.95 },{ \"category\": \"fiction\", 
\"author\": \"Evelyn Waugh\", \"title\": \"Sword of Honour\", \"price\": 12.99 
},{ \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": 
\"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 },{ \"category\": 
\"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": \"The Lord of the 
Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 },{ \"color\": \"red\", 
\"price\": 19.95 }]"
+"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of 
the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn 
Waugh\",\"title\":\"Sword of 
Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman 
Melville\",\"title\":\"Moby 
Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J.
 R. R. Tolkien\",\"title\":\"The Lord of the 
Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99},{\"color\":\"red\",\"price\":19.95}]"
 
 statement ok
 (o,l,w):= json.unfold(js)
@@ -45,23 +45,23 @@ io.print(o,l,w)
 0
 0
 NULL
-{ "category": "reference", "author": "Nigel Rees", "title": "Sayings of the 
Century", "price": 8.95 }
+{"category":"reference","author":"Nigel Rees","title":"Sayings of the 
Century","price":8.95}
 1
 1
 NULL
-{ "category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", 
"price": 12.99 }
+{"category":"fiction","author":"Evelyn Waugh","title":"Sword of 
Honour","price":12.99}
 2
 2
 NULL
-{ "category": "fiction", "author": "Herman Melville", "title": "Moby Dick", 
"isbn": "0-553-21311-3", "price": 8.99 }
+{"category":"fiction","author":"Herman Melville","title":"Moby 
Dick","isbn":"0-553-21311-3","price":8.99}
 3
 3
 NULL
-{ "category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of 
the Rings", "isbn": "0-395-19395-8", "price": 22.99 }
+{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the 
Rings","isbn":"0-395-19395-8","price":22.99}
 4
 4
 NULL
-{ "color": "red", "price": 19.95 }
+{"color":"red","price":19.95}
 
 statement ok
 barrier (i,j):= iterator.new(w)
@@ -75,19 +75,19 @@ redo (i,j) := iterator.next(w)
 query T rowsort
 exit (i,j)
 ----
-"{ \"category\": \"fiction\", \"author\": \"Evelyn Waugh\", \"title\": \"Sword 
of Honour\", \"price\": 12.99 }"
-"{ \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": 
\"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 }"
-"{ \"category\": \"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": 
\"The Lord of the Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 }"
-"{ \"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": 
\"Sayings of the Century\", \"price\": 8.95 }"
-"{ \"color\": \"red\", \"price\": 19.95 }"
+"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of 
Honour\",\"price\":12.99}"
+"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby 
Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}"
+"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The 
Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
+"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of 
the Century\",\"price\":8.95}"
+"{\"color\":\"red\",\"price\":19.95}"
 
 statement ok
-js := calc.json("[1,true, [2,false]]")
+js := calc.json("[1,true,[2,false]]")
 
 query T rowsort
 io.print(js)
 ----
-"[1,true, [2,false]]"
+"[1,true,[2,false]]"
 
 statement ok
 (l1,l2) := json.unfold(js)
diff --git a/monetdb5/modules/atoms/Tests/json05.maltest 
b/monetdb5/modules/atoms/Tests/json05.maltest
--- a/monetdb5/modules/atoms/Tests/json05.maltest
+++ b/monetdb5/modules/atoms/Tests/json05.maltest
@@ -4,7 +4,7 @@ js:= calc.json("[{\"book\":{ \"category\
 query T rowsort
 io.print(js)
 ----
-"[{\"book\":{ \"category\": \"reference\", \"author\": \"Nigel Rees\", 
\"title\": \"Sayings of the Century\", \"price\": 8.95 }, \"book\":{ 
\"category\": \"fiction\", \"author\": \"Evelyn Waugh\", \"title\": \"Sword of 
Honour\", \"price\": 12.99 }, \"book\":{ \"category\": \"fiction\", \"author\": 
\"Herman Melville\", \"title\": \"Moby Dick\", \"isbn\": \"0-553-21311-3\", 
\"price\": 8.99 }, \"book\":{ \"category\": \"fiction\", \"author\": \"J. R. R. 
Tolkien\", \"title\": \"The Lord of the Rings\", \"isbn\": \"0-395-19395-8\", 
\"price\": 22.99 }}, {\"pencil\":{ \"color\": \"red\", \"price\": 19.95 }}]"
+"[{\"book\":{\"category\":\"fiction\",\"author\":\"J. R. R. 
Tolkien\",\"title\":\"The Lord of the 
Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}},{\"pencil\":{\"color\":\"red\",\"price\":19.95}}]"
 
 statement ok
 p:= json.filter(js,"[0].book")
@@ -12,7 +12,7 @@ p:= json.filter(js,"[0].book")
 query T rowsort
 io.print(p)
 ----
-"{ \"category\": \"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": 
\"The Lord of the Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 }"
+"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The 
Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
 
 statement ok
 p:= json.filter(js,"[1].pencil")
@@ -20,7 +20,7 @@ p:= json.filter(js,"[1].pencil")
 query T rowsort
 io.print(p)
 ----
-"{ \"color\": \"red\", \"price\": 19.95 }"
+"{\"color\":\"red\",\"price\":19.95}"
 
 statement ok
 p:= json.filter(js,"..author")
@@ -44,7 +44,7 @@ p:= json.filter(js,"[0].book[0]")
 query T rowsort
 io.print(p)
 ----
-"{ \"category\": \"fiction\", \"author\": \"J. R. R. Tolkien\", \"title\": 
\"The Lord of the Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 }"
+"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The 
Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
 
 statement ok
 p:= json.filter(js,"[0].book[1]")
@@ -79,7 +79,7 @@ io.print(p)
 "[\"fiction\"]"
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to