Changeset: 0be46e17ee10 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0be46e17ee10
Modified Files:
        gdk/gdk_logger.c
        sql/backends/monet5/sql_upgrades.c
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
Branch: insertonly
Log Message:

Merge with default branch.


diffs (truncated from 4321 to 300 lines):

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/documentation/index.rst b/documentation/index.rst
--- a/documentation/index.rst
+++ b/documentation/index.rst
@@ -31,6 +31,7 @@ Welcome to MonetDB's documentation!
    source/cmake
    source/release
    source/developers_handbook
+   source/binary-resultset
 
 Indices and tables
 ==================
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2279,21 +2279,27 @@ mergejoin(BAT **r1p, BAT **r2p, BAT **r3
                                        }
                                        if (maybeextend(r1, r2, r3, nlx, 
lci->next, lci->ncand, maxsize) != GDK_SUCCEED)
                                                goto bailout;
+                                       if (r3)
+                                               r3->tnil = false;
                                        while (nlx > 0) {
                                                lv = canditer_next(lci);
                                                if (mlci == NULL || 
canditer_contains(mlci, lv)) {
                                                        APPEND(r1, lv);
                                                        if (r2)
                                                                APPEND(r2, 
oid_nil);
-                                                       if (r3)
-                                                               ((bit *) 
r3->theap->base)[r3->batCount++] = defmark;
+                                                       if (r3) {
+                                                               if (rhasnil || 
cmp(VALUE(l, lv - l->hseqbase), nil) == 0) {
+                                                                       ((bit 
*) r3->theap->base)[r3->batCount++] = bit_nil;
+                                                                       
r3->tnil = true;
+                                                               } else {
+                                                                       ((bit 
*) r3->theap->base)[r3->batCount++] = 0;
+                                                               }
+                                                       }
                                                }
                                                nlx--;
                                        }
                                        if (r1->trevsorted && BATcount(r1) > 1)
                                                r1->trevsorted = false;
-                                       if (r3)
-                                               r3->tnil = rhasnil;
                                } else {
                                        canditer_setidx(lci, lci->next + nlx);
                                }
@@ -2881,7 +2887,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT **r3
                                                APPEND(r2, oid_nil);    \
                                        }                               \
                                        if (r3) {                       \
-                                               r3->tnil = mark == bit_nil; \
+                                               r3->tnil |= mark == bit_nil; \
                                                ((bit *) 
r3->theap->base)[r3->batCount++] = mark; \
                                        }                               \
                                } else if (min_one) {                   \
@@ -3236,7 +3242,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p
                                                APPEND(r2, oid_nil);
                                        }
                                        if (r3) {
-                                               r3->tnil = mark == bit_nil;
+                                               r3->tnil |= mark == bit_nil;
                                                ((bit *) 
r3->theap->base)[r3->batCount++] = mark;
                                        }
                                } else if (min_one) {
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2421,10 +2421,15 @@ log_cleanup_range(logger *lg, ulng id)
 static void
 do_rotate(logger *lg)
 {
-       logged_range *next = lg->current->next;
+       logged_range *cur = lg->current;
+       logged_range *next = cur->next;
        if (next) {
                assert(ATOMIC_GET(&next->refcount) == 1);
-               lg->current = lg->current->next;
+               lg->current = next;
+               if (!LOG_DISABLED(lg) && ATOMIC_GET(&cur->refcount) == 1) {
+                       close_stream(cur->output_log);
+                       cur->output_log = NULL;
+               }
        }
 }
 
@@ -3099,7 +3104,14 @@ log_tflush(logger *lg, ulng file_id, uln
        }
        /* else somebody else has flushed our log file */
 
-       ATOMIC_DEC(&frange->refcount);
+       if (ATOMIC_DEC(&frange->refcount) == 1 && !LOG_DISABLED(lg)) {
+               rotation_lock(lg);
+               if (frange != lg->current) {
+                       close_stream(frange->output_log);
+                       frange->output_log = NULL;
+               }
+               rotation_unlock(lg);
+       }
 
        if (ATOMIC_DEC(&lg->nr_flushers) == 0) {
                /* I am the last flusher
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 <kutsu...@monetdbsolutions.com>
+- 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/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -46,7 +46,7 @@ tst045
 tst046
 tst047
 tst048
-tst049
+HAVE_LIBPCRE?tst049
 tst050
 tst051
 tst052
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)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to