Changeset: 12b6a49bd55c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/12b6a49bd55c
Modified Files:
        sql/server/rel_dump.c
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_select.c
        sql/storage/sql_catalog.c
Branch: antipush
Log Message:

Merged with default


diffs (truncated from 4791 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -71,9 +71,6 @@
 %bcond_without fits
 %endif
 
-%{!?__python3: %global __python3 /usr/bin/python3}
-%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-
 Name: %{name}
 Version: %{version}
 Release: %{release}
@@ -98,7 +95,7 @@ BuildRequires: hardlink
 BuildRequires: cmake3 >= 3.12
 BuildRequires: gcc
 BuildRequires: bison
-BuildRequires: /usr/bin/python3
+BuildRequires: python3-devel
 %if %{?rhel:1}%{!?rhel:0}
 # RH 7 (and for readline also 8)
 BuildRequires: bzip2-devel
@@ -682,7 +679,6 @@ package.  You probably don't need this, 
 Summary: MonetDB - Monet Database Management System
 Group: Applications/Databases
 Requires: %{name}-client-tests = %{version}-%{release}
-Requires: /usr/bin/python3
 BuildArch: noarch
 
 %description testing-python
@@ -842,6 +838,15 @@ else
     /usr/bin/hardlink -cv %{buildroot}%{_datadir}/selinux
 fi
 
+# update shebang lines for Python scripts
+%if %{?py3_shebang_fix:1}%{!?py3_shebang_fix:0}
+    # Fedora has py3_shebang_fix macro
+    %{py3_shebang_fix} %{buildroot}%{_bindir}/*.py
+%else
+    # EPEL does not, but we can use the script directly
+    /usr/bin/pathfix.py -pni "%{__python3} -s" %{buildroot}%{_bindir}/*.py
+%endif
+
 %changelog
 * Thu Sep 30 2021 Sjoerd Mullender <[email protected]> - 11.41.11-20210930
 - Rebuilt.
diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -637,7 +637,7 @@
 [ "bat",       "getRole",      "command bat.getRole(X_0:bat[:any_1]):str ",    
"BKCgetRole;",  "Returns the rolename of the head column of a BAT."     ]
 [ "bat",       "getSequenceBase",      "command 
bat.getSequenceBase(X_0:bat[:any_1]):oid ",    "BKCgetSequenceBase;",  "Get the 
sequence base for the void column of a BAT."   ]
 [ "bat",       "getSize",      "command bat.getSize(X_0:bat[:any_1]):lng ",    
"BKCgetSize;",  "Calculate the actual size of the BAT descriptor, heaps, hashes 
and imprint indices in bytes\nrounded to the memory page size (see 
bbp.getPageSize())." ]
-[ "bat",       "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng 
",       "BKCgetVHeapSize;",     "Calculate the vheap size for string bats"     
 ]
+[ "bat",       "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng 
",       "BKCgetVHeapSize;",     "Calculate the vheap size for varsized bats"   
 ]
 [ "bat",       "getorderidx",  "pattern 
bat.getorderidx(X_0:bat[:any_1]):bat[:oid] ",  "OIDXgetorderidx;",     "Return 
the order index if it exists"   ]
 [ "bat",       "hasorderidx",  "pattern bat.hasorderidx(X_0:bat[:any_1]):bit 
",        "OIDXhasorderidx;",     "Return true if order index exists"     ]
 [ "bat",       "imprints",     "command bat.imprints(X_0:bat[:bte]):void ",    
"CMDBATimprints;",      ""      ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -750,7 +750,7 @@
 [ "bat",       "getRole",      "command bat.getRole(X_0:bat[:any_1]):str ",    
"BKCgetRole;",  "Returns the rolename of the head column of a BAT."     ]
 [ "bat",       "getSequenceBase",      "command 
bat.getSequenceBase(X_0:bat[:any_1]):oid ",    "BKCgetSequenceBase;",  "Get the 
sequence base for the void column of a BAT."   ]
 [ "bat",       "getSize",      "command bat.getSize(X_0:bat[:any_1]):lng ",    
"BKCgetSize;",  "Calculate the actual size of the BAT descriptor, heaps, hashes 
and imprint indices in bytes\nrounded to the memory page size (see 
bbp.getPageSize())." ]
-[ "bat",       "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng 
",       "BKCgetVHeapSize;",     "Calculate the vheap size for string bats"     
 ]
+[ "bat",       "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng 
",       "BKCgetVHeapSize;",     "Calculate the vheap size for varsized bats"   
 ]
 [ "bat",       "getorderidx",  "pattern 
bat.getorderidx(X_0:bat[:any_1]):bat[:oid] ",  "OIDXgetorderidx;",     "Return 
the order index if it exists"   ]
 [ "bat",       "hasorderidx",  "pattern bat.hasorderidx(X_0:bat[:any_1]):bit 
",        "OIDXhasorderidx;",     "Return true if order index exists"     ]
 [ "bat",       "imprints",     "command bat.imprints(X_0:bat[:bte]):void ",    
"CMDBATimprints;",      ""      ]
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -835,7 +835,7 @@ BBPcheckbats(unsigned bbpversion)
                                }
                        }
 #else
-                       /* first check string offset heap without widht,
+                       /* first check string offset heap without width,
                         * then with */
 #ifdef GDKLIBRARY_TAILN
                        /* if bbpversion > GDKLIBRARY_TAILN, the offset heap can
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -16835,6 +16835,7 @@ VARconvert(ValPtr ret, const ValRecord *
                        nils = BUN_NONE;
                }
                ret->val.mval = tmp.val.btval;
+               ret->len = ATOMsize(TYPE_msk);
        } else if (v->vtype == TYPE_msk) {
                ValRecord tmp;
                tmp.vtype = TYPE_bit;
@@ -16845,9 +16846,11 @@ VARconvert(ValPtr ret, const ValRecord *
                if (v->vtype == TYPE_void ||
                    (*ATOMcompare(v->vtype))(VALptr(v),
                                             ATOMnilptr(v->vtype)) == 0) {
-                       ret->val.sval = GDKstrdup(str_nil);
+                       if (VALinit(ret, TYPE_str, str_nil) == NULL)
+                               return GDK_FAIL;
                } else if (BATatoms[v->vtype].atomToStr == 
BATatoms[TYPE_str].atomToStr) {
-                       ret->val.sval = GDKstrdup(v->val.sval);
+                       if (VALinit(ret, TYPE_str, v->val.sval) == NULL)
+                               return GDK_FAIL;
                } else {
                        ret->len = 0;
                        ret->val.sval = NULL;
@@ -16858,25 +16861,24 @@ VARconvert(ValPtr ret, const ValRecord *
                                GDKfree(ret->val.sval);
                                ret->val.sval = NULL;
                                ret->len = 0;
-                               nils = BUN_NONE;
-                       }
-               }
-               if (ret->val.sval == NULL)
-                       nils = BUN_NONE;
+                               return GDK_FAIL;
+                       }
+               }
        } else if (ret->vtype == TYPE_void) {
                if (abort_on_error &&
                    ATOMcmp(v->vtype, VALptr(v), ATOMnilptr(v->vtype)) != 0) {
                        GDKerror("22003!cannot convert non-nil to void.\n");
-                       nils = BUN_NONE;
+                       return GDK_FAIL;
                }
                ret->val.oval = oid_nil;
+               ret->len = ATOMsize(TYPE_void);
        } else if (v->vtype == TYPE_void) {
                if (VALinit(ret, ret->vtype, ATOMnilptr(ret->vtype)) == NULL)
-                       nils = BUN_NONE;
+                       return GDK_FAIL;
        } else if (v->vtype == TYPE_str) {
                if (strNil(v->val.sval)) {
                        if (VALinit(ret, ret->vtype, ATOMnilptr(ret->vtype)) == 
NULL)
-                               nils = BUN_NONE;
+                               return GDK_FAIL;
                } else if (ATOMstorage(ret->vtype) == TYPE_ptr) {
                        nils = BUN_NONE + 1;
                } else {
@@ -16912,7 +16914,7 @@ VARconvert(ValPtr ret, const ValRecord *
                                                 "to type %s failed.\n",
                                                 ATOMname(ret->vtype));
                                }
-                               nils = BUN_NONE;
+                               return GDK_FAIL;
                        } else {
                                /* now give value obtained to ret */
                                assert(ATOMextern(ret->vtype) ||
@@ -16928,15 +16930,14 @@ VARconvert(ValPtr ret, const ValRecord *
                                              &(struct 
canditer){.tpe=cand_dense, .ncand=1},
                                              0, abort_on_error, &reduce,
                                              scale1, scale2, precision);
-       }
-       if (nils >= BUN_NONE) {
-               if (nils == BUN_NONE + 1) {
-                       GDKerror("conversion from type %s to type %s "
-                               "unsupported.\n",
-                               ATOMname(v->vtype), ATOMname(ret->vtype));
-               }
+               if (nils < BUN_NONE)
+                       ret->len = ATOMlen(ret->vtype, VALptr(ret));
+       }
+       if (nils == BUN_NONE + 1) {
+               GDKerror("conversion from type %s to type %s "
+                        "unsupported.\n",
+                        ATOMname(v->vtype), ATOMname(ret->vtype));
                return GDK_FAIL;
        }
-       ret->len = ATOMlen(ret->vtype, VALptr(ret));
-       return GDK_SUCCEED;
-}
+       return nils == BUN_NONE ? GDK_FAIL : GDK_SUCCEED;
+}
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -282,7 +282,7 @@ log_read_seq(logger *lg, logformat *l)
        BUN p;
 
        assert(!lg->inmemory);
-       if (!mnstr_readLng(lg->input_log, &val)) {
+       if (mnstr_readLng(lg->input_log, &val) != 1) {
                TRC_CRITICAL(GDK, "read failed\n");
                return LOG_EOF;
        }
@@ -375,7 +375,7 @@ string_reader(logger *lg, BAT *b, lng nr
 }
 
 static log_return
-log_read_updates(logger *lg, trans *tr, logformat *l, log_id id, lng offset)
+log_read_updates(logger *lg, trans *tr, logformat *l, log_id id)
 {
        log_return res = LOG_OK;
        lng nr, pnr;
@@ -386,7 +386,7 @@ log_read_updates(logger *lg, trans *tr, 
        if (lg->debug & 1)
                fprintf(stderr, "#logger found log_read_updates %d %s\n", id, 
l->flag == LOG_UPDATE ? "update" : "update_buld");
 
-       if (!mnstr_readLng(lg->input_log, &nr) ||
+       if (mnstr_readLng(lg->input_log, &nr) != 1 ||
            mnstr_read(lg->input_log, &type_id, 1, 1) != 1)
                return LOG_ERR;
 
@@ -396,6 +396,7 @@ log_read_updates(logger *lg, trans *tr, 
                BAT *uid = NULL;
                BAT *r = NULL;
                void *(*rt) (ptr, size_t *, stream *, size_t) = 
BATatoms[tpe].atomRead;
+               lng offset;
 
                assert(nr <= (lng) BUN_MAX);
                if (!lg->flushing && l->flag == LOG_UPDATE) {
@@ -414,7 +415,7 @@ log_read_updates(logger *lg, trans *tr, 
                }
 
                if (l->flag == LOG_UPDATE_CONST) {
-                       if (!mnstr_readLng(lg->input_log, &offset)) {
+                       if (mnstr_readLng(lg->input_log, &offset) != 1) {
                                if (r)
                                        BBPreclaim(r);
                                return LOG_ERR;
@@ -432,7 +433,7 @@ log_read_updates(logger *lg, trans *tr, 
                                }
                        }
                } else if (l->flag == LOG_UPDATE_BULK) {
-                       if (!mnstr_readLng(lg->input_log, &offset)) {
+                       if (mnstr_readLng(lg->input_log, &offset) != 1) {
                                if (r)
                                        BBPreclaim(r);
                                return LOG_ERR;
@@ -502,6 +503,7 @@ log_read_updates(logger *lg, trans *tr, 
                } else {
                        void *(*rh) (ptr, size_t *, stream *, size_t) = 
BATatoms[TYPE_oid].atomRead;
                        void *hv = ATOMnil(TYPE_oid);
+                       offset = 0;
 
                        if (hv == NULL)
                                res = LOG_ERR;
@@ -1163,7 +1165,7 @@ logger_read_transaction(logger *lg)
                        if (tr == NULL)
                                err = LOG_EOF;
                        else
-                               err = log_read_updates(lg, tr, &l, l.id, 0);
+                               err = log_read_updates(lg, tr, &l, l.id);
                        break;
                case LOG_CREATE:
                        if (tr == NULL)
diff --git a/gdk/gdk_value.c b/gdk/gdk_value.c
--- a/gdk/gdk_value.c
+++ b/gdk/gdk_value.c
@@ -150,11 +150,7 @@ VALcopy(ValPtr d, const ValRecord *s)
        if (!ATOMextern(s->vtype)) {
                *d = *s;
        } else if (s->val.pval == NULL) {
-               d->val.pval = ATOMnil(s->vtype);
-               if (d->val.pval == NULL)
-                       return NULL;
-               d->vtype = s->vtype;
-               d->len = ATOMlen(d->vtype, VALptr(d));
+               return VALinit(d, s->vtype, ATOMnilptr(s->vtype));
        } else if (s->vtype == TYPE_str) {
                const char *p = s->val.sval;
                d->vtype = TYPE_str;
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
@@ -122,13 +122,11 @@ newComment(MalBlkPtr mb, const char *val
                return NULL;
        q->token = REMsymbol;
        q->barrier = 0;
-       cst.vtype= TYPE_str;
-       if ((cst.val.sval= GDKstrdup(val)) == NULL) {
+       if (VALinit(&cst, TYPE_str, val) == NULL) {
                str msg = createException(MAL, "newComment", "Can not allocate 
comment");
                addMalException(mb, msg);
                freeException(msg);
        } else {
-               cst.len = strlen(cst.val.sval);
                k = defConstant(mb, TYPE_str, &cst);
                if( k >= 0){
                        getArg(q,0) = k;
@@ -514,13 +512,12 @@ getStrConstant(MalBlkPtr mb, str val)
        int _t;
        ValRecord cst;
 
-       cst.vtype = TYPE_str;
-       cst.val.sval = val;
-       cst.len = strlen(val);
+       VALset(&cst, TYPE_str, val);
        _t= fndConstant(mb, &cst, MAL_VAR_WINDOW);
        if( _t < 0) {
-               if ((cst.val.sval= GDKstrdup(val)) == NULL)
+               if ((cst.val.sval = GDKmalloc(cst.len)) == NULL)
                        return -1;
+               memcpy(cst.val.sval, val, cst.len); /* includes terminating \0 
*/
                _t = defConstant(mb, TYPE_str, &cst);
        }
        assert(_t >= 0);
@@ -535,13 +532,11 @@ pushStr(MalBlkPtr mb, InstrPtr q, const 
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to