Changeset: 807a1e354613 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/807a1e354613
Modified Files:
        gdk/gdk_utils.c
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_statement.c
        sql/backends/monet5/sql_statement.h
        sql/server/rel_psm.c
Branch: nested
Log Message:

merged with default


diffs (truncated from 1384 to 300 lines):

diff --git a/buildtools/conf/Maddlog b/buildtools/conf/Maddlog
--- a/buildtools/conf/Maddlog
+++ b/buildtools/conf/Maddlog
@@ -1,5 +1,4 @@
 #!/usr/bin/env bash
-# -*-shell-script-*-
 
 # SPDX-License-Identifier: MPL-2.0
 #
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -2170,6 +2170,9 @@ ma_reset(allocator *sa)
        sa->size = MA_NUM_BLOCKS;
        sa->blks[0] = sa->first_blk;
        sa->used = offset;
+#if !defined(NDEBUG) && !defined(SANITIZER)
+       DEADBEEFCHK memset((char *) sa->blks[0] + offset, '\xDB', MA_BLOCK_SIZE 
- offset);
+#endif
 #ifndef NDEBUG
        sa->frees = 0;
 #endif
@@ -2232,6 +2235,9 @@ ma_fill_in_header(void *r, size_t sz)
                // store canary value to help us detect double free
                rs[1] = CANARY_VALUE;
                r = &rs[2];
+#if !defined(NDEBUG) && !defined(SANITIZER)
+               DEADBEEFCHK memset(r, '\xBD', sz);
+#endif
        }
        return r;
 }
diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -129,7 +129,7 @@ typedef struct {
 
 libgeom_export gdk_return libgeom_init(void);
 
-#define mbr_nil mbrFromGeos(NULL);
+#define mbr_nil mbrFromGeos(NULL, NULL);
 
 libgeom_export bool is_wkb_nil(const wkb *wkbp);
 libgeom_export GEOSGeom wkb2geos(const wkb *geomWKB);
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -2396,10 +2396,9 @@ geos2wkb(allocator *ma, wkb **geomWKB, s
 
 /* gets the mbr from the geometry */
 mbr *
-mbrFromGeos(const GEOSGeom geosGeometry)
-{
-       allocator *ma = MT_thread_getallocator();
-       assert(ma);
+mbrFromGeos(allocator *ma, const GEOSGeom geosGeometry)
+{
+       assert(ma != NULL || geosGeometry == NULL);
        GEOSGeom envelope;
        mbr *geomMBR;
        double xmin = 0, ymin = 0, xmax = 0, ymax = 0;
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -48,7 +48,7 @@ extern str wkbFromWKB(Client ctx, wkb **
 
 /* gets a GEOSGeometry and returns the mbr of it
  * works only for 2D geometries */
-extern mbr* mbrFromGeos(const GEOSGeom geosGeometry)
+extern mbr* mbrFromGeos(allocator *ma, const GEOSGeom geosGeometry)
        __attribute__((__visibility__("hidden")));
 
 
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -532,7 +532,7 @@ filterJoinRTree(bat *lres_id, bat *rres_
                        continue;
 
                //Calculate the MBR for the constant geometry
-               mbr *outer_mbr = mbrFromGeos(outer_geom);
+               mbr *outer_mbr = mbrFromGeos(ta, outer_geom);
                BUN* results_rtree = RTREEsearch(ta, inner_b, outer_mbr, 
outer_ci.ncand);
                if (results_rtree == NULL) {
                        msg = createException(MAL, name, "RTreesearch failed, 
returned NULL candidates");
diff --git a/geom/monetdb5/geom_atoms.c b/geom/monetdb5/geom_atoms.c
--- a/geom/monetdb5/geom_atoms.c
+++ b/geom/monetdb5/geom_atoms.c
@@ -653,7 +653,7 @@ wkbMBR(Client ctx, mbr **geomMBR, wkb **
                throw(MAL, "geom.MBR", SQLSTATE(38000) "Geos problem converting 
GEOS to WKB");
        }
 
-       *geomMBR = mbrFromGeos(geosGeometry);
+       *geomMBR = mbrFromGeos(ma, geosGeometry);
 
        GEOSGeom_destroy_r(geoshandle, geosGeometry);
 
diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py
--- a/misc/python/fixlicense.py
+++ b/misc/python/fixlicense.py
@@ -205,20 +205,6 @@ def addlicense(file, pre=None, post=None
             # add a blank line
             addblank = True
             line = f.readline()
-        if '-*-' in line:
-            # if file starts with an Emacs mode specification, keep
-            # the line there
-            g.write(line)
-            # add a blank line
-            addblank = True
-            line = f.readline()
-        if 'vim:' in line:
-            # if file starts with a vim mode specification, keep
-            # the line there
-            g.write(line)
-            # add a blank line
-            addblank = True
-            line = f.readline()
         if line.startswith('<?xml'):
             # if line starts with an XML declaration, keep the line there
             g.write(line)
@@ -328,16 +314,6 @@ def dellicense(file, pre=None, post=None
             line = f.readline()
             if line and line == '\n':
                 line = f.readline()
-        if '-*-' in line:
-            g.write(line)
-            line = f.readline()
-            if line and line == '\n':
-                line = f.readline()
-        if 'vim:' in line:
-            g.write(line)
-            line = f.readline()
-            if line and line == '\n':
-                line = f.readline()
         if line.startswith('<?xml'):
             g.write(line)
             line = f.readline()
@@ -456,14 +432,6 @@ def listfile(file, pre=None, post=None, 
             line = f.readline()
             if line and line == '\n':
                 line = f.readline()
-        if '-*-' in line:
-            line = f.readline()
-            if line and line == '\n':
-                line = f.readline()
-        if 'vim:' in line:
-            line = f.readline()
-            if line and line == '\n':
-                line = f.readline()
         if line.startswith('<?xml'):
             line = f.readline()
             if line and line == '\n':
diff --git a/monetdb5/modules/atoms/inet.c b/monetdb5/modules/atoms/inet.c
--- a/monetdb5/modules/atoms/inet.c
+++ b/monetdb5/modules/atoms/inet.c
@@ -561,10 +561,10 @@ INEThost(Client ctx, str *retval, const 
        if (is_inet_nil(val)) {
                *retval = (char *) str_nil;
        } else {
-               ip = ma_alloc(ma, sizeof(char) * 16);
+               ip = ma_alloc(ma, 16);
                if (ip == NULL)
                        throw(MAL, "INEThost", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               sprintf(ip, "%d.%d.%d.%d", val->q1, val->q2, val->q3, val->q4);
+               snprintf(ip, 16, "%d.%d.%d.%d", val->q1, val->q2, val->q3, 
val->q4);
                *retval = ip;
        }
        return (MAL_SUCCEED);
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1958,6 +1958,8 @@ scan_loop_strselect(BAT *rl, BATiter *li
        BATsetcount(rl, BATcount(rl));
        if (BATcount(rl) > 0) {
                BATnegateprops(rl);
+               rl->tsorted = true;
+               rl->tkey = true;
                rl->tnonil = true;
                rl->tnil = false;
        }
diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -451,8 +451,8 @@ ALGmarkselect(Client ctx, bat *r1, bat *
                if (nr) {
                        ri1[q] = c-1;
                        ri2[q] = (m == TRUE)?TRUE:(has_nil)?bit_nil:FALSE;
+                       q++;
                }
-               q++;
        }
        BATsetcount(res1, q);
        BATsetcount(res2, q);
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -3646,6 +3646,7 @@ rel2bin_groupjoin(backend *be, sql_rel *
        if (!left || !right)
                return NULL;
        left = row2cols(be, left);
+       stmt *lgid = stmt_identity(be, bin_find_smallest_column(be, left));
        right = row2cols(be, right);
 
        bool equality_only = true;
@@ -3727,6 +3728,8 @@ rel2bin_groupjoin(backend *be, sql_rel *
                        s = stmt_alias(be, s, c->label, rnme, nme);
                        list_append(nl, s);
                }
+               if (lgid)
+                       lgid = stmt_project(be, jl, lgid);
                for (n = right->op4.lval->h; n; n = n->next) {
                        stmt *c = n->data;
                        assert(c->label);
@@ -3764,7 +3767,7 @@ rel2bin_groupjoin(backend *be, sql_rel *
                                p = stmt_const(be, bin_find_smallest_column(be, 
sub), p);
                        if (sel)
                                p = stmt_project(be, sel, column(be, p));
-                       stmt *li = jl;
+                       stmt *li = lgid;
                        if (sel)
                                li = stmt_project(be, sel, li);
                        osel = sel;
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -1226,6 +1226,35 @@ stmt_result(backend *be, stmt *s, int nr
        return ns;
 }
 
+stmt *
+stmt_identity(backend *be, stmt *s)
+{
+       MalBlkPtr mb = be->mb;
+
+       if (s == NULL)
+               goto bailout;
+
+       InstrPtr q = dump_1(mb, batcalcRef, identityRef, s);
+
+       if (q) {
+               stmt *ns = stmt_create(be->mvc->sa, st_mirror);
+               if (ns == NULL) {
+                       goto bailout;
+               }
+
+               ns->op1 = s;
+               ns->nrcols = 2;
+               ns->key = s->key;
+               ns->aggr = s->aggr;
+               ns->q = q;
+               ns->nr = getDestVar(q);
+               return ns;
+       }
+  bailout:
+       if (ma_get_eb(be->mvc->sa)->enabled)
+               eb_error(ma_get_eb(be->mvc->sa), be->mvc->errstr[0] ? 
be->mvc->errstr : mb->errors ? mb->errors : *GDKerrbuf ? GDKerrbuf : "out of 
memory", 1000);
+       return NULL;
+}
 
 /* limit maybe atom nil */
 stmt *
diff --git a/sql/backends/monet5/sql_statement.h 
b/sql/backends/monet5/sql_statement.h
--- a/sql/backends/monet5/sql_statement.h
+++ b/sql/backends/monet5/sql_statement.h
@@ -240,6 +240,7 @@ extern stmt *stmt_const(backend *be, stm
 extern stmt *stmt_gen_group(backend *be, stmt *gids, stmt *cnts);      /* 
given a gid,cnt blowup to full groups */
 extern stmt *stmt_mirror(backend *be, stmt *s);
 extern stmt *stmt_result(backend *be, stmt *s, int nr);
+extern stmt *stmt_identity(backend *be, stmt *s);
 
 /*
  * dir:      direction of the ordering, ie 1 Ascending, 0 descending
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -1234,11 +1234,11 @@ resolve_func(mvc *sql, const char *sname
                                                arg_list = tpe;
                                        }
                                }
+                               if (!if_exists)
+                                       e = sql_error(sql, ERR_NOTFOUND, 
SQLSTATE(42000) "%s %s: no such %s '%s' (%s)", op, F, fn, name, arg_list);
                                ma_close(&ta_state);
                                list_destroy(list_func);
                                list_destroy(type_list);
-                               if (!if_exists)
-                                       e = sql_error(sql, ERR_NOTFOUND, 
SQLSTATE(42000) "%s %s: no such %s '%s' (%s)", op, F, fn, name, arg_list);
                                return e;
                        }
                        list_destroy(list_func);
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-join-not-in.Bug-6519.test
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-join-not-in.Bug-6519.test
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-join-not-in.Bug-6519.test
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-join-not-in.Bug-6519.test
@@ -25,7 +25,7 @@ NULL
 
 query II rowsort
 SELECT ALL + + MIN ( DISTINCT - - 14 ) AS col1, CAST ( - SUM ( DISTINCT 74 ) 
AS BIGINT ) col0 FROM tab2 AS cor0
-WHERE NULL BETWEEN col0 AND NULL; --NULL, NULL
+WHERE NULL BETWEEN col0 AND NULL
 ----
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to