Changeset: 2dff2c49559a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2dff2c49559a
Modified Files:
        gdk/gdk_logger.c
        sql/backends/monet5/sql_upgrades.c
Branch: insertonly
Log Message:

Merge with default branch.


diffs (truncated from 1258 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -812,3 +812,4 @@ 573511e0e7bf2f7ab11f00b45711aab5f1aff6f2
 ce63ebe9a78c52ef0cbe8fd6f2159d2637f0387c Jun2023_7
 1efa83c6409769d13b2ee30e497d5f7ab42fa955 Jun2023_9
 6f88424ebfd9d82c072cf21d89070e04321983da Jun2023_11
+6f88424ebfd9d82c072cf21d89070e04321983da Jun2023_SP2_release
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/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1484,6 +1484,8 @@ BBPtrim(bool aggressive)
        if (!aggressive)
                flag |= BBPHOT;
        for (bat bid = 1, nbat = (bat) ATOMIC_GET(&BBPsize); bid < nbat; bid++) 
{
+               if (GDKexiting())
+                       return changed;
                /* don't do this during a (sub)commit */
                BBPtmlock();
                MT_lock_set(&GDKswapLock(bid));
diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c
--- a/gdk/gdk_tm.c
+++ b/gdk/gdk_tm.c
@@ -61,6 +61,10 @@ epilogue(int cnt, bat *subcommit, bool l
                BAT *b;
 
                if (BBP_status(bid) & BBPPERSISTENT) {
+                       /* first turn off BBPNEW, then turn on
+                        * BBPEXISTING so that concurrent BATassertProps
+                        * doesn't fail */
+                       BBP_status_off(bid, BBPNEW);
                        BBP_status_on(bid, BBPEXISTING);
                } else if (BBP_status(bid) & BBPDELETED) {
                        /* check mmap modes of bats that are now
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/json01.maltest 
b/monetdb5/modules/atoms/Tests/json01.maltest
--- a/monetdb5/modules/atoms/Tests/json01.maltest
+++ b/monetdb5/modules/atoms/Tests/json01.maltest
@@ -56,7 +56,7 @@ f:= json.filter(b,"f1[1]")
 query T rowsort
 io.print(f)
 ----
-"3"
+"[]"
 
 statement ok
 f:= json.filter(b,"f1[2]")
@@ -72,7 +72,7 @@ f:= json.filter(b,"*")
 query T rowsort
 io.print(f)
 ----
-"[1,2,3]"
+"[3,2]"
 
 statement ok
 b:= json.new("{\"f1\":{\"f12\":3},\"f2\":[2,3,4]}")
diff --git a/monetdb5/modules/atoms/Tests/json02.maltest 
b/monetdb5/modules/atoms/Tests/json02.maltest
--- a/monetdb5/modules/atoms/Tests/json02.maltest
+++ b/monetdb5/modules/atoms/Tests/json02.maltest
@@ -57,8 +57,6 @@ 0
 f1
 1
 f2
-2
-f1
 
 statement ok
 ff:= json.values(b)
@@ -67,11 +65,9 @@ query IT rowsort
 io.print(ff)
 ----
 0
-1
+3
 1
 2
-2
-3
 
 statement ok
 b:= json.new("{\"f1\":{\"f12\":3},\"f2\":[2,3,4]}")
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
@@ -28,7 +28,7 @@ p:= json.filter(js,"..author")
 query T rowsort
 io.print(p)
 ----
-"[\"Nigel Rees\",\"Evelyn Waugh\",\"Herman Melville\",\"J. R. R. Tolkien\"]"
+"[\"J. R. R. Tolkien\"]"
 
 statement ok
 p:= json.filter(js,"..category")
@@ -36,7 +36,7 @@ p:= json.filter(js,"..category")
 query T rowsort
 io.print(p)
 ----
-"[\"reference\",\"fiction\",\"fiction\",\"fiction\"]"
+"[\"fiction\"]"
 
 statement ok
 p:= json.filter(js,"[0].book[0]")
@@ -44,7 +44,7 @@ p:= json.filter(js,"[0].book[0]")
 query T rowsort
 io.print(p)
 ----
-"{ \"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": 
\"Sayings of the Century\", \"price\": 8.95 }"
+"{ \"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]")
@@ -52,7 +52,7 @@ p:= json.filter(js,"[0].book[1]")
 query T rowsort
 io.print(p)
 ----
-"{ \"category\": \"fiction\", \"author\": \"Evelyn Waugh\", \"title\": \"Sword 
of Honour\", \"price\": 12.99 }"
+"[]"
 
 statement ok
 p:= json.filter(js,"[0].book[2]")
@@ -60,7 +60,7 @@ p:= json.filter(js,"[0].book[2]")
 query T rowsort
 io.print(p)
 ----
-"{ \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": 
\"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 }"
+"[]"
 
 statement ok
 p:= json.filter(js,"[0].book[3]")
@@ -68,7 +68,7 @@ p:= json.filter(js,"[0].book[3]")
 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 }"
+"[]"
 
 statement ok
 p:= json.filter(js,"[0].book..category")
diff --git a/monetdb5/modules/atoms/Tests/json08.maltest 
b/monetdb5/modules/atoms/Tests/json08.maltest
--- a/monetdb5/modules/atoms/Tests/json08.maltest
+++ b/monetdb5/modules/atoms/Tests/json08.maltest
@@ -78,7 +78,7 @@ 1
 2
 1
 3
-1
+3
 4
 {"f12":3}
 
diff --git a/monetdb5/modules/atoms/Tests/json10.maltest 
b/monetdb5/modules/atoms/Tests/json10.maltest
--- a/monetdb5/modules/atoms/Tests/json10.maltest
+++ b/monetdb5/modules/atoms/Tests/json10.maltest
@@ -51,7 +51,7 @@ f:= json.text(b)
 query T rowsort
 io.print(f)
 ----
-"1 world 3"
+"3 world"
 
 statement ok
 b:= json.new("{\"f1\":{\"f12\":3},\"f2\":[2,3,4], \"f3\":true}")
diff --git a/monetdb5/modules/atoms/Tests/json11.maltest 
b/monetdb5/modules/atoms/Tests/json11.maltest
--- a/monetdb5/modules/atoms/Tests/json11.maltest
+++ b/monetdb5/modules/atoms/Tests/json11.maltest
@@ -51,7 +51,7 @@ f:= json.text(b,",")
 query T rowsort
 io.print(f)
 ----
-"1,2,3"
+"3,2"
 
 statement ok
 b:= json.new("{\"f1\":{\"f12\":3},\"f2\":[2,3,4], \"f3\":true}")
diff --git a/monetdb5/modules/atoms/Tests/json13.maltest 
b/monetdb5/modules/atoms/Tests/json13.maltest
--- a/monetdb5/modules/atoms/Tests/json13.maltest
+++ b/monetdb5/modules/atoms/Tests/json13.maltest
@@ -53,7 +53,7 @@ p:= json.filter(js,".store.*")
 query T rowsort
 io.print(p)
 ----
-"[{ \"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
 p:= json.filter(js,".store..price")
@@ -93,5 +93,5 @@ p:= json.filter(js,"$")
 query T rowsort
 io.print(p)
 ----
-"[{ \"store\": { \"book\": [ { \"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 } ], \"bicycle\": { \"color\": \"red\", \"price\": 19.95 } } }]"
+"{ \"store\": { \"book\": [ { \"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 } ], \"bicycle\": { \"color\": \"red\", \"price\": 19.95 } } }"
 
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -637,6 +637,7 @@ JSONgetValue(JSON *jt, int idx)
        return s;
 }
 
+/* eats res and r */
 static str
 JSONglue(str res, str r, char sep)
 {
@@ -743,8 +744,9 @@ JSONmatch(JSON *jt, int ji, pattern *ter
                                                r = JSONgetValue(jt, 
jt->elm[i].child);
                                                if (r == NULL)
                                                        r = (str) -1;
-                                       } else
+                                       } else {
                                                r = JSONmatch(jt, 
jt->elm[i].child, terms, ti + 1, terms[ti].index == INT_MAX);
+                                       }
                                        if (r == (str) -1 || r == (str) -2) {
                                                GDKfree(res);
                                                return r;
@@ -754,7 +756,7 @@ JSONmatch(JSON *jt, int ji, pattern *ter
                                        } else {  // Keep the last matching 
value
                                                if (res)
                                                        GDKfree(res);
-                                               res = GDKstrdup(r);
+                                               res = r;
                                        }
                                }
                                cnt++;
@@ -845,9 +847,9 @@ JSONfilterInternal(json *ret, json *js, 
                // pattern contains the .. operator
                if (terms[i].token == ANY_STEP ||
                        // pattern contains the [*] operator
-                       (terms[i].token == CHILD_STEP && terms[i].index == 
INT_MAX && terms[i].name == NULL)) {
+                       (terms[i].token == CHILD_STEP && terms[i].index == 
INT_MAX && terms[i].name == NULL) ||
+                       (terms[i].token == CHILD_STEP && terms[i].index == 
INT_MAX && *terms[i].name == '*')) {
 
-               /* if (terms[i].make_array) { */
                        return_array = true;
                        break;
                }
@@ -1058,6 +1060,7 @@ JSONtoken(JSON *jt, const char *j, const
        str msg;
        int nxt, idx = JSONnew(jt);
        const char *string_start = j;
+       int pidx;
 
        if (jt->error)
                return idx;
@@ -1095,12 +1098,36 @@ JSONtoken(JSON *jt, const char *j, const
                        int chld = JSONtoken(jt, j, next);
                        if (jt->error)
                                return idx;
-                       jt->elm[nxt].child = chld;
-                       jt->elm[nxt].value++;
-                       jt->elm[nxt].valuelen -= 2;
-                       JSONappend(jt, idx, nxt);
-                       if (jt->error)
-                               return idx;
+
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to