Changeset: 95d03e341003 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=95d03e341003
Added Files:
        sql/test/BugTracker-2015/Tests/and_or_expression.Bug-3851.sql
        sql/test/BugTracker-2015/Tests/and_or_expression.Bug-3851.stable.err
        sql/test/BugTracker-2015/Tests/and_or_expression.Bug-3851.stable.out
        sql/test/BugTracker-2015/Tests/expression_with_comparison.Bug-3854.sql
        
sql/test/BugTracker-2015/Tests/expression_with_comparison.Bug-3854.stable.err
        
sql/test/BugTracker-2015/Tests/expression_with_comparison.Bug-3854.stable.out
        sql/test/BugTracker-2015/Tests/limit_dbl.Bug-3847.sql
        sql/test/BugTracker-2015/Tests/limit_dbl.Bug-3847.stable.err
        sql/test/BugTracker-2015/Tests/limit_dbl.Bug-3847.stable.out
        sql/test/BugTracker-2015/Tests/long_insert.Bug-3845.stable.err
        sql/test/BugTracker-2015/Tests/long_insert.Bug-3845.stable.out
Modified Files:
        clients/R/MonetDB.R/R/dbi.R
        clients/R/Tests/All
        clients/R/Tests/deps-install.R
        clients/R/Tests/deps-test.R
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/mapilib/mapi.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_firstn.c
        java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
        monetdb5/extras/rapi/rapi.c
        monetdb5/mal/mal.c
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_session.c
        monetdb5/modules/mal/01_batcalc.mal
        monetdb5/modules/mal/batcalc.c
        monetdb5/optimizer/opt_reorder.c
        sql/server/rel_optimizer.c
        sql/server/rel_select.c
        sql/test/BugTracker-2015/Tests/All
        sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.sql
        sql/test/testdb-upgrade/Tests/dump.stable.out.Windows
        testing/Mtest.py.in
Branch: default
Log Message:

Merge with Jul2015 branch.


diffs (truncated from 1436 to 300 lines):

diff --git a/clients/R/MonetDB.R/R/dbi.R b/clients/R/MonetDB.R/R/dbi.R
--- a/clients/R/MonetDB.R/R/dbi.R
+++ b/clients/R/MonetDB.R/R/dbi.R
@@ -477,9 +477,13 @@ setMethod("dbFetch", signature(res="Mone
   if (!dbIsValid(res)) {
     stop("Cannot fetch results from closed response.")
   }
-  
+
   # okay, so we arrive here with the tuples from the first result in 
res@env$data as a list
   info <- res@env$info
+  # apparently, one should be able to fetch results sets from ddl ops
+  if (info$type == Q_UPDATE) {
+    return(data.frame())
+  }
   if (res@env$delivered < 0) {
     res@env$delivered <- 0
   }
diff --git a/clients/R/Tests/All b/clients/R/Tests/All
--- a/clients/R/Tests/All
+++ b/clients/R/Tests/All
@@ -5,6 +5,5 @@ HAVE_LIBR?dbi
 HAVE_LIBR?survey
 HAVE_LIBR?dplyr
 HAVE_LIBR?dplyr-flights
-HAVE_LIBR?dbapply
+HAVE_LIBR&NOT_WIN32?dbapply
 HAVE_LIBR?testrandom
-
diff --git a/clients/R/Tests/deps-install.R b/clients/R/Tests/deps-install.R
--- a/clients/R/Tests/deps-install.R
+++ b/clients/R/Tests/deps-install.R
@@ -6,8 +6,8 @@ dd <- capture.output(suppressMessages(su
        (function(lp) {
        np <- lp[!(lp %in% installed.packages()[,"Package"])]
        repos <- "http://cran.rstudio.com/";
-       if(length(np)) install.packages(np,repos=repos, type="source", quiet=T)
-       update.packages(repos=repos, ask=F, oldPkgs=lp, type="source", quiet=T)
+       if(length(np)) install.packages(np,repos=repos, quiet=T)
+       update.packages(repos=repos, ask=F, oldPkgs=lp, quiet=T)
        x <- lapply(lp,function(x){library(x,character.only=TRUE,quietly=T)}) 
        })(c("DBI", "digest"))
 })))
diff --git a/clients/R/Tests/deps-test.R b/clients/R/Tests/deps-test.R
--- a/clients/R/Tests/deps-test.R
+++ b/clients/R/Tests/deps-test.R
@@ -3,8 +3,8 @@ dd <- capture.output(suppressMessages(su
        (function(lp) {
        np <- lp[!(lp %in% installed.packages()[,"Package"])]
        repos <- 
c('http://download.r-forge.r-project.org','http://cran.rstudio.com/')
-       if(length(np)) install.packages(np,repos=repos, type="source", quiet=T)
-       update.packages(repos=repos, ask=F, oldPkgs=lp, type="source", quiet=T)
+       if(length(np)) install.packages(np,repos=repos, quiet=T)
+       update.packages(repos=repos, ask=F, oldPkgs=lp, quiet=T)
        x <- lapply(lp,function(x){library(x,character.only=TRUE,quietly=T)}) 
        })(c('Rcpp', 'dplyr','survey','sqlsurvey','Lahman','nycflights13'))
 })))
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
@@ -24677,6 +24677,18 @@ pattern batcalc.ifthenelse(b:bat[:oid,:b
 address CMDifthen;
 comment If-then-else operation to assemble a conditional result
 
+pattern 
batcalc.ifthenelse(v:bit,b1:bat[:oid,:any_1],v2:any_1):bat[:oid,:any_1] 
+address CMDifthen;
+comment If-then-else operation to assemble a conditional result
+
+pattern 
batcalc.ifthenelse(v:bit,v1:any_1,b2:bat[:oid,:any_1]):bat[:oid,:any_1] 
+address CMDifthen;
+comment If-then-else operation to assemble a conditional result
+
+pattern 
batcalc.ifthenelse(v:bit,b1:bat[:oid,:any_1],b2:bat[:oid,:any_1]):bat[:oid,:any_1]
 
+address CMDifthen;
+comment If-then-else operation to assemble a conditional result
+
 pattern batcalc.int_noerror(b:bat[:oid,:str],s:bat[:oid,:oid]):bat[:oid,:int] 
 address CMDconvert_int;
 comment cast from str to int with candidates list
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
@@ -31906,6 +31906,18 @@ pattern batcalc.ifthenelse(b:bat[:oid,:b
 address CMDifthen;
 comment If-then-else operation to assemble a conditional result
 
+pattern 
batcalc.ifthenelse(v:bit,b1:bat[:oid,:any_1],v2:any_1):bat[:oid,:any_1] 
+address CMDifthen;
+comment If-then-else operation to assemble a conditional result
+
+pattern 
batcalc.ifthenelse(v:bit,v1:any_1,b2:bat[:oid,:any_1]):bat[:oid,:any_1] 
+address CMDifthen;
+comment If-then-else operation to assemble a conditional result
+
+pattern 
batcalc.ifthenelse(v:bit,b1:bat[:oid,:any_1],b2:bat[:oid,:any_1]):bat[:oid,:any_1]
 
+address CMDifthen;
+comment If-then-else operation to assemble a conditional result
+
 pattern batcalc.int_noerror(b:bat[:oid,:str],s:bat[:oid,:oid]):bat[:oid,:int] 
 address CMDconvert_int;
 comment cast from str to int with candidates list
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2114,7 +2114,10 @@ mapi_mapi(const char *host, int port, co
                        struct dirent *e;
                        struct stat st;
                        char found = 0;
-                       int socks[24];
+                       struct {
+                               int port;
+                               uid_t owner;
+                       } socks[24];
                        int i = 0;
                        int len;
                        uid_t me = getuid();
@@ -2126,56 +2129,55 @@ mapi_mapi(const char *host, int port, co
                                                continue;
                                        if (snprintf(buf, sizeof(buf), 
"/tmp/%s", e->d_name) >= (int) sizeof(buf))
                                                continue; /* ignore long name */
-                                       if (stat(buf, &st) != -1 && 
S_ISSOCK(st.st_mode))
-                                               socks[i++] = atoi(e->d_name + 
11);
-                                       if (i == sizeof(socks))
+                                       if (stat(buf, &st) != -1 && 
S_ISSOCK(st.st_mode)) {
+                                               socks[i].owner = st.st_uid;
+                                               socks[i++].port = 
atoi(e->d_name + 11);
+                                       }
+                                       if (i == sizeof(socks) / 
sizeof(socks[0]))
                                                break;
                                }
                                closedir(d);
                                len = i;
                                /* case 2bI) first those with a matching owner 
*/
                                for (i = 0; found == 0 && i < len; i++) {
-                                       snprintf(buf, sizeof(buf), 
"/tmp/.s.monetdb.%d", socks[i]);
-                                       if (socks[i] != 0 &&
-                                                       stat(buf, &st) != -1 && 
st.st_uid == me)
-                                       {
+                                       if (socks[i].port != 0 &&
+                                           socks[i].owner == me) {
                                                Mapi tmid;
                                                /* try this server for the 
database */
-                                               tmid = mapi_mapi("/tmp", 
socks[i], "mero", "mero",
-                                                               lang, dbname);
+                                               tmid = mapi_mapi("/tmp", 
socks[i].port, "mero", "mero",
+                                                                lang, dbname);
                                                tmid->redirmax = 0;
                                                if (connect_to_server(tmid) == 
MOK &&
-                                                               
(mapi_start_talking(tmid) == MOK ||
-                                                                
*tmid->redirects != NULL ||
-                                                                
(tmid->errorstr != NULL &&
-                                                                 
strstr(tmid->errorstr, "under maintenance") != NULL)))
-                                               {
+                                                   (mapi_start_talking(tmid) 
== MOK ||
+                                                    *tmid->redirects != NULL ||
+                                                    (tmid->errorstr != NULL &&
+                                                     strstr(tmid->errorstr, 
"under maintenance") != NULL))) {
+                                                       snprintf(buf, 
sizeof(buf), "/tmp/.s.monetdb.%d", socks[i].port);
                                                        host = buf;
-                                                       port = socks[i];
+                                                       port = socks[i].port;
                                                        found = 1;
                                                }
                                                mapi_disconnect(tmid);
                                                mapi_destroy(tmid);
-                                               socks[i] = 0; /* don't need to 
try again */
+                                               socks[i].port = 0; /* don't 
need to try again */
                                        }
                                }
                                /* case 2bII) the other sockets */
                                for (i = 0; found == 0 && i < len; i++) {
-                                       snprintf(buf, sizeof(buf), 
"/tmp/.s.monetdb.%d", socks[i]);
-                                       if (socks[i] != 0 && stat(buf, &st) != 
-1) {
+                                       if (socks[i].port != 0) {
                                                Mapi tmid;
                                                /* try this server for the 
database */
-                                               tmid = mapi_mapi("/tmp", 
socks[i], "mero", "mero",
+                                               tmid = mapi_mapi("/tmp", 
socks[i].port, "mero", "mero",
                                                                lang, dbname);
                                                tmid->redirmax = 0;
                                                if (connect_to_server(tmid) == 
MOK &&
-                                                               
(mapi_start_talking(tmid) == MOK ||
-                                                                
*tmid->redirects != NULL ||
-                                                                
(tmid->errorstr != NULL &&
-                                                                 
strstr(tmid->errorstr, "under maintenance") != NULL)))
-                                               {
+                                                   (mapi_start_talking(tmid) 
== MOK ||
+                                                    *tmid->redirects != NULL ||
+                                                    (tmid->errorstr != NULL &&
+                                                     strstr(tmid->errorstr, 
"under maintenance") != NULL))) {
+                                                       snprintf(buf, 
sizeof(buf), "/tmp/.s.monetdb.%d", socks[i].port);
                                                        host = buf;
-                                                       port = socks[i];
+                                                       port = socks[i].port;
                                                        found = 1;
                                                }
                                                mapi_disconnect(tmid);
@@ -2548,6 +2550,7 @@ mapi_start_talking(Mapi mid)
        check_stream(mid, mid->from, "Connection terminated while starting", 
"mapi_start_talking", (mid->blk.eos = 1, mid->error));
 
        assert(len < BLOCK);
+       buf[len] = 0;
 
        if (len == 0){
                mapi_setError(mid, "Challenge string is not valid, it is 
empty", "mapi_start_talking", MERROR);
@@ -2662,7 +2665,7 @@ mapi_start_talking(Mapi mid)
                        }
 
                        free(mid->password);
-                       mid->password = malloc(sizeof(char) * (1 + 
strlen(pwdhash) + 1));
+                       mid->password = malloc(1 + strlen(pwdhash) + 1);
                        sprintf(mid->password, "\1%s", pwdhash);
                        free(pwdhash);
                }
@@ -2678,7 +2681,7 @@ mapi_start_talking(Mapi mid)
                                if (pwh == NULL)
                                        continue;
                                len = strlen(pwh) + 11 /* {RIPEMD160} */ + 1;
-                               hash = malloc(sizeof(char) * len);
+                               hash = malloc(len);
                                snprintf(hash, len, "{%s}%s", *algs, pwh);
                                free(pwh);
                                break;
@@ -2771,7 +2774,7 @@ mapi_start_talking(Mapi mid)
                                        break;
                                case '^':{
                                        char **r = mid->redirects;
-                                       int m = sizeof(mid->redirects) - 1;
+                                       int m = sizeof(mid->redirects) / 
sizeof(mid->redirects[0]) - 1;
                                        for (; *r != NULL && m > 0; r++)
                                                m--;
                                        if (m == 0)
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2820,6 +2820,8 @@ BATassertHeadProps(BAT *b)
        /* only linear atoms can be sorted */
        assert(!b->hsorted || ATOMlinear(b->htype));
        assert(!b->hrevsorted || ATOMlinear(b->htype));
+       /* var heaps must have sane sizes */
+       assert(b->H->vheap == NULL || b->H->vheap->free <= b->H->vheap->size);
 
        if (!b->hkey && !b->hsorted && !b->hrevsorted &&
            !b->H->nonil && !b->H->nil) {
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1426,7 +1426,7 @@ BATconstant(int tailtype, const void *v,
        if (bn == NULL)
                return NULL;
        p = Tloc(bn, bn->batFirst);
-       switch (ATOMstorage(tailtype)) {
+       switch (ATOMbasetype(tailtype)) {
        case TYPE_void:
                v = &oid_nil;
                BATseqbase(BATmirror(bn), oid_nil);
@@ -1455,7 +1455,6 @@ BATconstant(int tailtype, const void *v,
        case TYPE_hge:
                for (i = 0; i < n; i++)
                        ((hge *) p)[i] = *(hge *) v;
-               bn->T->nil = n >= 1 && *(hge *) v == hge_nil;
                break;
 #endif
        default:
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -684,7 +684,7 @@ fixoidheap(void)
  * BBPdir file.
  */
 static int
-heapinit(COLrec *col, const char *buf, int *hashash, const char *HT, int 
oidsize, int bbpversion, lng batid)
+heapinit(COLrec *col, const char *buf, int *hashash, const char *HT, int 
oidsize, int bbpversion, bat bid)
 {
        int t;
        char type[11];
@@ -725,7 +725,7 @@ heapinit(COLrec *col, const char *buf, i
        if ((t = ATOMindex(type)) < 0)
                t = ATOMunknown_find(type);
        else if (var != (t == TYPE_void || BATatoms[t].atomPut != NULL))
-               GDKfatal("BBPinit: inconsistent entry in BBP.dir: %s.varsized 
mismatch for BAT " LLFMT "\n", HT, batid);
+               GDKfatal("BBPinit: inconsistent entry in BBP.dir: %s.varsized 
mismatch for BAT %d\n", HT, (int) bid);
        else if (var && t != 0 ?
                 ATOMsize(t) < width ||
                 (width != 1 && width != 2 && width != 4
@@ -738,7 +738,7 @@ heapinit(COLrec *col, const char *buf, i
                 && (t != TYPE_oid || oidsize == 0 || width != oidsize)
 #endif
                )
-               GDKfatal("BBPinit: inconsistent entry in BBP.dir: %s.size 
mismatch for BAT " LLFMT "\n", HT, batid);
+               GDKfatal("BBPinit: inconsistent entry in BBP.dir: %s.size 
mismatch for BAT %d\n", HT, (int) bid);
        col->type = t;
        col->width = width;
        col->varsized = var != 0;
@@ -770,6 +770,8 @@ heapinit(COLrec *col, const char *buf, i
                col->sorted = 0;
                col->revsorted = 0;
        }
+       if (col->heap.free > col->heap.size)
+               GDKfatal("BBPinit: \"free\" value larger than \"size\" in heap 
of bat %d\n", (int) bid);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to