Changeset: 0bc23334a468 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0bc23334a468
Modified Files:
        clients/R/MonetDB.R/DESCRIPTION
        clients/R/MonetDB.R/NEWS
        clients/R/MonetDB.R/R/control.R
        clients/R/MonetDB.R/R/monetdb.R
        gdk/gdk_unique.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/atoms/json.mal
        monetdb5/optimizer/opt_centipede.c
        monetdb5/optimizer/opt_pushselect.c
        sql/benchmarks/tpch/Tests/17-plan.stable.out
        sql/benchmarks/tpch/Tests/22-plan.stable.out
        sql/common/sql_types.c
        sql/scripts/40_json.sql
        sql/test/BugTracker/Tests/between_with_column.SF-1959410.stable.err
        sql/test/centipede/Tests/olap.stable.out
        sql/test/json/Tests/aggregate01.sql
        sql/test/json/Tests/aggregate01.stable.out
Branch: RIntegration-default
Log Message:

merge with default


diffs (truncated from 553 to 300 lines):

diff --git a/clients/R/MonetDB.R/DESCRIPTION b/clients/R/MonetDB.R/DESCRIPTION
--- a/clients/R/MonetDB.R/DESCRIPTION
+++ b/clients/R/MonetDB.R/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: MonetDB.R
-Version: 0.9.2
-Date: 2013-04-22
+Version: 0.9.3
+Date: 2013-06-10
 Title: Connect MonetDB to R
 Authors@R: c(person("Hannes Muehleisen", role = c("aut", "cre"),email = 
"[email protected]"),
        person("Thomas Lumley", role = "ctb"),
diff --git a/clients/R/MonetDB.R/NEWS b/clients/R/MonetDB.R/NEWS
--- a/clients/R/MonetDB.R/NEWS
+++ b/clients/R/MonetDB.R/NEWS
@@ -1,3 +1,6 @@
+0.9.3
+- Remove trailing slashes for monetdb.program.path parameter for 
monetdb.server.setup (Thanks, Anthony!)
+
 0.9.2
 - monetdb_queryinfo method to find out things about an arbitrary query cheaply
 - new options monetdb.sequential, monetdb.debug.query and monetdb.debug.mapi
diff --git a/clients/R/MonetDB.R/R/control.R b/clients/R/MonetDB.R/R/control.R
--- a/clients/R/MonetDB.R/R/control.R
+++ b/clients/R/MonetDB.R/R/control.R
@@ -114,6 +114,8 @@ monetdb.server.setup <-
 
     # switch all slashes to match windows
     monetdb.program.path <- normalizePath( monetdb.program.path , mustWork = 
FALSE )
+    # remove trailing slash from paths, otherwise the server won't start
+    monetdb.program.path <- gsub("\\\\$|/$", "", monetdb.program.path)
     database.directory <- normalizePath( database.directory , mustWork = FALSE 
)
         
     # if the database directory does not exist, print that it's being created
@@ -266,4 +268,4 @@ monetdbd.liststatus <- monetdb.liststatu
   dbdf$scenarios <- gsub("'", ", ", dbdf$scenarios, fixed=T)
   
   return(dbdf[order(dbdf$dbname), ])
-}
\ No newline at end of file
+}
diff --git a/clients/R/MonetDB.R/R/monetdb.R b/clients/R/MonetDB.R/R/monetdb.R
--- a/clients/R/MonetDB.R/R/monetdb.R
+++ b/clients/R/MonetDB.R/R/monetdb.R
@@ -21,7 +21,7 @@ MonetR <- MonetDB <- MonetDBR <- MonetDB
 
 setMethod("dbGetInfo", "MonetDBDriver", def=function(dbObj, ...)
   list(name="MonetDBDriver", 
-       driver.version="0.9.2", 
+       driver.version="0.9.3", 
        DBI.version="0.2-7", 
        client.version=NA, 
        max.connections=NA)
diff --git a/gdk/gdk_unique.c b/gdk/gdk_unique.c
--- a/gdk/gdk_unique.c
+++ b/gdk/gdk_unique.c
@@ -96,6 +96,15 @@ BATsubunique(BAT *b, BAT *s)
                return bn;
        }
 
+       if (cand && BATcount(b) > 16 * BATcount(s)) {
+               BAT *nb = BATproject(s, b); 
+               BAT *r = BATsubunique(nb, 0);
+               BAT *nr = BATproject(r, s);
+               BBPunfix(nb->batCacheid);
+               BBPunfix(r->batCacheid);
+               return nr;
+       }
+
        assert(b->ttype != TYPE_void);
 
        bn = BATnew(TYPE_void, TYPE_oid, 1024);
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
@@ -1761,12 +1761,6 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                        }
                }
        }
-       if (g && BATtdense(g)) {
-               /* singleton groups: return group ID's (g's tail) and original
-                * values from b */
-               bn = VIEWcreate(BATmirror(g), b);
-               goto out;
-       }
 
        maxlen = BUFSIZ;
        if ((buf = GDKmalloc(maxlen)) == NULL) {
@@ -1798,12 +1792,69 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                } else {
                        map = (const oid *) Tloc(t2, BUNfirst(t2));
                }
+               if (g && BATtdense(g)) {
+                       for (p = 0, q = BATcount(g); p < q; p++) {
+                               switch(b->ttype) {
+                               case  TYPE_str:
+                                       v = (const char *) BUNtail(bi, 
BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff));
+                                       break;
+                               case TYPE_dbl:
+                                       val = (const double *) BUNtail(bi, 
BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff));
+                                       if (*val != dbl_nil) {
+                                               snprintf(temp, sizeof(temp), 
"%f", *val);
+                                               v = (const char *)temp;
+                                       } else {
+                                               v =  NULL;
+                                       }
+                                       break;
+                               }
+                               if (!v||strNil(v)) {
+                                       if (skip_nils)
+                                               continue;
+                                       strncpy(buf, str_nil, buflen);
+                                       isnil = 1;
+                               } else {
+                                       len = strlen(v);
+                                       if (len >= maxlen - buflen) {
+                                               maxlen += len + BUFSIZ;
+                                               buf = GDKrealloc(buf, maxlen);
+                                               if (buf == NULL) {
+                                                       err = MAL_MALLOC_FAIL;
+                                                       goto bunins_failed;
+                                               }
+                                       }
+                                       switch (b->ttype) {
+                                       case TYPE_str:
+                                               len = snprintf(buf + buflen, 
maxlen - buflen, "[ \"%s\" ]", v);
+                                               buflen += len;
+                                               break;
+                                       case TYPE_dbl:
+                                               len = snprintf(buf + buflen, 
maxlen - buflen, "[ %s ]", v);
+                                               buflen += len;
+                                               break;
+                                       }
+                               }
+                               bunfastapp_nocheck(bn, BUNlast(bn), buf, 
Tsize(bn));
+                               buflen = 0;
+                       }
+                       BATseqbase(bn, min);
+                       bn->T->nil = nils != 0;
+                       bn->T->nonil = nils == 0;
+                       bn->T->sorted = BATcount(bn) <= 1;
+                       bn->T->revsorted = BATcount(bn) <= 1;
+                       bn->T->key = BATcount(bn) <= 1;
+                       goto out;
+               }
                grps = (const oid *) Tloc(g, BUNfirst(g));
                prev = grps[0];
                isnil = 0;
                for (p = 0, q = BATcount(g); p <= q; p++) {
+                       if (p == 0) {
+                               strncpy(buf + buflen, "[ ", maxlen - buflen);
+                               buflen += 2;
+                       }
                        if (p == q || grps[p] != prev) {
-                               strncpy(buf + buflen, " ]", buflen);
+                               strncpy(buf + buflen, " ]", maxlen - buflen);
                                buflen += 2;
                                while (BATcount(bn) < prev - min) {
                                        bunfastapp_nocheck(bn, BUNlast(bn), 
str_nil, Tsize(bn));
@@ -1811,11 +1862,13 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                                }
                                bunfastapp_nocheck(bn, BUNlast(bn), buf, 
Tsize(bn));
                                nils += strNil(buf);
-                               strncpy(buf, str_nil, maxlen);
+                               strncpy(buf + buflen, str_nil, maxlen - buflen);
                                buflen = 0;
                                if (p == q)
                                        break;
                                prev = grps[p];
+                               strncpy(buf + buflen, "[ ", maxlen - buflen);
+                               buflen += 2;
                                isnil = 0;
                        }
                        if (isnil)
@@ -1851,8 +1904,8 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                                }
                                switch (b->ttype) {
                                case TYPE_str:
-                                       if (buflen == 0) {
-                                               len = snprintf(buf + buflen, 
maxlen - buflen, "[ \"%s\"", v);
+                                       if (buflen == 2) {
+                                               len = snprintf(buf + buflen, 
maxlen - buflen, "\"%s\"", v);
                                                buflen += len;
                                        } else {
                                                len = snprintf(buf + buflen, 
maxlen - buflen, ", \"%s\"", v);
@@ -1860,8 +1913,8 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                                        }
                                        break;
                                case TYPE_dbl:
-                                       if (buflen == 0) {
-                                               len = snprintf(buf + buflen, 
maxlen - buflen, "[ %s", v);
+                                       if (buflen == 2) {
+                                               len = snprintf(buf + buflen, 
maxlen - buflen, "%s", v);
                                                buflen += len;
                                        } else {
                                                len = snprintf(buf + buflen, 
maxlen - buflen, ", %s", v);
@@ -1875,8 +1928,22 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                t2 = NULL;
        } else {
                for (p = BUNfirst(b), q = p + BATcount(b); p < q; p++) {
-                       v = (const char *) BUNtail(bi, p);
-                       if (strNil(v)) {
+                       switch(b->ttype) {
+                               case  TYPE_str:
+                                 v = (const char *) BUNtail(bi, p);
+                               break;
+                       case TYPE_dbl:
+                               val = (const double *) BUNtail(bi, p);
+                               if (*val != dbl_nil) {
+                                       snprintf(temp, sizeof(temp), "%f", 
*val);
+                                       v = (const char *)temp;
+                               } else {
+                                       v =  NULL;
+                               }
+                               break;
+                       }
+
+                       if (!v||strNil(v)) {
                                if (skip_nils)
                                        continue;
                                strncpy(buf, str_nil, buflen);
@@ -1892,12 +1959,25 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                                        goto bunins_failed;
                                }
                        }
-                       if (buflen == 0) {
-                               len = snprintf(buf + buflen, maxlen - buflen, 
"[ \"%s\"", v);
-                               buflen += len;
-                       } else {
-                               len = snprintf(buf + buflen, maxlen - buflen, 
", \"%s\"", v);
-                               buflen += len;
+                       switch (b->ttype) {
+                       case TYPE_str:
+                         if (buflen == 2) {
+                           len = snprintf(buf + buflen, maxlen - buflen, 
"\"%s\"", v);
+                           buflen += len;
+                         } else {
+                           len = snprintf(buf + buflen, maxlen - buflen, ", 
\"%s\"", v);
+                           buflen += len;
+                         }
+                         break;
+                       case TYPE_dbl:
+                         if (buflen == 2) {
+                           len = snprintf(buf + buflen, maxlen - buflen, "%s", 
v);
+                           buflen += len;
+                         } else {
+                           len = snprintf(buf + buflen, maxlen - buflen, ", 
%s", v);
+                           buflen += len;
+                         }
+                         break;
                        }
                }
                bunfastapp_nocheck(bn, BUNlast(bn), buf, Tsize(bn));
diff --git a/monetdb5/modules/atoms/json.mal b/monetdb5/modules/atoms/json.mal
--- a/monetdb5/modules/atoms/json.mal
+++ b/monetdb5/modules/atoms/json.mal
@@ -168,27 +168,27 @@ pattern calc.isnil(v:json):bit
 address CMDvarISNIL
 comment "Nil test for json value";
 
-command json.aggr(val:bat[:oid,:str]):str
+command aggr.jsonaggr(val:bat[:oid,:str]):str
 address JSONgroupStr
 comment "Aggregate the string values to array.";
 
-command json.aggr(val:bat[:oid,:dbl]):str
+command aggr.jsonaggr(val:bat[:oid,:dbl]):str
 address JSONgroupStr
 comment "Aggregate the double values to array.";
 
-command json.subaggr(val:bat[:oid,:str],g:bat[:oid,:oid],e:bat[:oid,:any_1], 
skip_nils:bit) :bat[:oid,:str]
+command 
aggr.subjsonaggr(val:bat[:oid,:str],g:bat[:oid,:oid],e:bat[:oid,:any_1], 
skip_nils:bit) :bat[:oid,:str]
 address JSONsubjson
 comment "Grouped aggregation of values.";
 
-command json.subaggr(val:bat[:oid,:dbl],g:bat[:oid,:oid],e:bat[:oid,:any_1], 
skip_nils:bit) :bat[:oid,:str]
+command 
aggr.subjsonaggr(val:bat[:oid,:dbl],g:bat[:oid,:oid],e:bat[:oid,:any_1], 
skip_nils:bit) :bat[:oid,:str]
 address JSONsubjson
 comment "Grouped aggregation of values.";
 
-command 
json.subaggr(val:bat[:oid,:str],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],
 skip_nils:bit) :bat[:oid,:str]
+command 
aggr.subjsonaggr(val:bat[:oid,:str],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],
 skip_nils:bit) :bat[:oid,:str]
 address JSONsubjsoncand
 comment "Grouped aggregation of values with candidates list.";
 
-command 
json.subaggr(val:bat[:oid,:dbl],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],
 skip_nils:bit) :bat[:oid,:str]
+command 
aggr.subjsonaggr(val:bat[:oid,:dbl],g:bat[:oid,:oid],e:bat[:oid,:any_1],s:bat[:oid,:oid],
 skip_nils:bit) :bat[:oid,:str]
 address JSONsubjsoncand
 comment "Grouped aggregation of values with candidates list.";
 
diff --git a/monetdb5/optimizer/opt_centipede.c 
b/monetdb5/optimizer/opt_centipede.c
--- a/monetdb5/optimizer/opt_centipede.c
+++ b/monetdb5/optimizer/opt_centipede.c
@@ -32,8 +32,8 @@
 #include "mal_interpreter.h"
 #include "algebra.h"
 
-#define DEBUG_OPT_DETAIL
-#define _DEBUG_OPT_CENTIPEDE_ 
+//#define DEBUG_OPT_DETAIL
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to