Changeset: de20cb3f92f6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/de20cb3f92f6
Branch: reducedstack
Log Message:

merged with default


diffs (truncated from 903 to 300 lines):

diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1
--- a/clients/mapiclient/mclient.1
+++ b/clients/mapiclient/mclient.1
@@ -120,6 +120,9 @@ Print usage information and exit.
 \fB\-\-version\fP (\fB\-v\fP)
 Print version information and exit.
 .TP
+\fB\-\-quiet\fP (\fB\-q\fP)
+Be quiet: don't print welcome message at startup.
+.TP
 \fB\-\-encoding=\fP\fIencoding\fP (\fB\-E\fP \fIencoding\fP)
 Specify the character encoding of the input.
 The option applies to both the standard input of
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3280,6 +3280,7 @@ usage(const char *prog, int xit)
        mnstr_printf(stderr_stream, " -| cmd      | --pager=cmd        for 
pagination\n");
 #endif
        mnstr_printf(stderr_stream, " -v          | --version          show 
version information and exit\n");
+       mnstr_printf(stderr_stream, " -q          | --quiet            don't 
print welcome message\n");
        mnstr_printf(stderr_stream, " -?          | --help             show 
this usage message\n");
 
        mnstr_printf(stderr_stream, "\nSQL specific options \n");
@@ -3355,6 +3356,7 @@ main(int argc, char **argv)
        bool trace = false;
        bool dump = false;
        bool useinserts = false;
+       bool quiet = false;
        int c = 0;
        Mapi mid;
        bool save_history = false;
@@ -3387,6 +3389,7 @@ main(int argc, char **argv)
                {"pager", 1, 0, '|'},
 #endif
                {"port", 1, 0, 'p'},
+               {"quiet", 0, 0, 'q'},
                {"rows", 1, 0, 'r'},
                {"statement", 1, 0, 's'},
                {"user", 1, 0, 'u'},
@@ -3469,7 +3472,7 @@ main(int argc, char **argv)
 #ifdef HAVE_ICONV
                                "E:"
 #endif
-                               "f:h:Hil:L:n:Np:P:r:Rs:t:u:vw:Xz"
+                               "f:h:Hil:L:n:Np:P:qr:Rs:t:u:vw:Xz"
 #ifdef HAVE_POPEN
                                "|:"
 #endif
@@ -3553,6 +3556,9 @@ main(int argc, char **argv)
                        passwd = optarg;
                        passwd_set_as_flag = true;
                        break;
+               case 'q':
+                       quiet = true;
+                       break;
                case 'r':
                        assert(optarg);
                        rowsperpage = atoi(optarg);
@@ -3765,7 +3771,7 @@ main(int argc, char **argv)
 
        mapi_trace(mid, trace);
        /* give the user a welcome message with some general info */
-       if (!has_fileargs && command == NULL && isatty(fileno(stdin))) {
+       if (!quiet && !has_fileargs && command == NULL && 
isatty(fileno(stdin))) {
                char *lang;
 
                catch_interrupts(mid);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1518,11 +1518,13 @@ BATsettrivprop(BAT *b)
                        b->tnil = !b->tnonil;
                        b->trevsorted = true;
                        b->tkey = b->batCount <= 1;
+                       b->tunique_est = b->batCount == 0 ? 0.0 : 1.0;
                } else {
                        b->tnonil = true;
                        b->tnil = false;
                        b->tkey = true;
                        b->trevsorted = b->batCount <= 1;
+                       b->tunique_est = (double) b->batCount;
                }
                b->tsorted = true;
        } else if (b->batCount <= 1) {
@@ -1591,11 +1593,15 @@ BATsettrivprop(BAT *b)
                b->tnokey[0] = 0;
                b->tnokey[1] = !b->tkey;
                b->tunique_est = (double) (1 + b->tkey);
-       } else if (!ATOMlinear(b->ttype)) {
-               b->tsorted = false;
-               b->trevsorted = false;
-               b->tminpos = BUN_NONE;
-               b->tmaxpos = BUN_NONE;
+       } else {
+               if (!ATOMlinear(b->ttype)) {
+                       b->tsorted = false;
+                       b->trevsorted = false;
+                       b->tminpos = BUN_NONE;
+                       b->tmaxpos = BUN_NONE;
+               }
+               if (b->tkey)
+                       b->tunique_est = (double) b->batCount;
        }
 }
 
@@ -1663,9 +1669,7 @@ BATnegateprops(BAT *b)
  * this is a NULL pointer.
  */
 #define GDKMAXERRLEN   10240
-#define GDKWARNING     "!WARNING: "
 #define GDKERROR       "!ERROR: "
-#define GDKMESSAGE     "!OS: "
 #define GDKFATAL       "!FATAL: "
 
 /* Data Distilleries uses ICU for internationalization of some MonetDB error 
messages */
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -788,7 +788,9 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool 
                        b->tminpos = BUN_NONE;
                }
        }
-       if (ci.ncand > BATcount(b) / gdk_unique_estimate_keep_fraction) {
+       if (BATcount(b) == 0 && ci.ncand == ni.count)
+               b->tunique_est = ni.unique_est;
+       else if (ci.ncand > BATcount(b) / gdk_unique_estimate_keep_fraction) {
                b->tunique_est = 0;
        }
        MT_lock_unset(&b->theaplock);
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2810,7 +2810,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT **r3
                                                break;                  \
                                        }                               \
                                        HASHLOOPBODY();                 \
-                                       if (semi && !max_one)           \
+                                       if (semi)                       \
                                                break;                  \
                                }                                       \
                        } else if (rci->tpe != cand_dense) {            \
@@ -2825,7 +2825,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT **r3
                                                        break;          \
                                                }                       \
                                                HASHLOOPBODY();         \
-                                               if (semi && !max_one)   \
+                                               if (semi)               \
                                                        break;          \
                                        }                               \
                                }                                       \
@@ -2841,7 +2841,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT **r3
                                                }                       \
                                                ro = (oid) (rb - roff + rseq); \
                                                HASHLOOPBODY();         \
-                                               if (semi && !max_one)   \
+                                               if (semi)               \
                                                        break;          \
                                        }                               \
                                }                                       \
@@ -3083,6 +3083,16 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p
                goto bailout;
        }
 
+       /* from here on, semi is used to bail out early from the
+        * collision lists; if right is key, it's effectively a
+        * semi-join, and max_one is automatically satisfied; otherwise,
+        * we need to continue looking if max_one is specified to make
+        * sure there is only one match */
+       if (r->tkey)
+               semi = true;
+       else if (max_one)
+               semi = false;
+
        r1 = *r1p;
        r2 = r2p ? *r2p : NULL;
        r3 = r3p ? *r3p : NULL;
@@ -3143,7 +3153,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p
                                                break;
                                        }
                                        HASHLOOPBODY();
-                                       if (semi && !max_one)
+                                       if (semi)
                                                break;
                                }
                        } else if (hsh == NULL) {
@@ -3159,7 +3169,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p
                                                        break;
                                                }
                                                HASHLOOPBODY();
-                                               if (semi && !max_one)
+                                               if (semi)
                                                        break;
                                        }
                                }
@@ -3175,7 +3185,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p
                                                        break;
                                                }
                                                HASHLOOPBODY();
-                                               if (semi && !max_one)
+                                               if (semi)
                                                        break;
                                        }
                                }
@@ -3191,7 +3201,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p
                                                }
                                                ro = (oid) (rb - roff + rseq);
                                                HASHLOOPBODY();
-                                               if (semi && !max_one)
+                                               if (semi)
                                                        break;
                                        }
                                }
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -340,7 +340,7 @@ ilog2(BUN x)
        ATOMname(b->ttype),                                             \
        
b->ttype==TYPE_str?b->twidth==1?"1":b->twidth==2?"2":b->twidth==4?"4":"8":"", \
        !b->batTransient ? "P" : b->theap && b->theap->parentid != 
b->batCacheid ? "V" : b->tvheap && b->tvheap->parentid != b->batCacheid ? "v" : 
"T", \
-       BATtdense(b) ? "D" : b->ttype == TYPE_void && b->tvheap ? "X" : 
ATOMstorage(b->ttype) == TYPE_str && GDK_ELIMDOUBLES(b->tvheap) ? "E" : "", \
+       BATtdense(b) ? "D" : b->ttype == TYPE_void && b->tvheap ? "X" : 
ATOMstorage(b->ttype) == TYPE_str && b->tvheap && GDK_ELIMDOUBLES(b->tvheap) ? 
"E" : "", \
        b->tsorted ? "S" : b->tnosorted ? "!s" : "",                    \
        b->trevsorted ? "R" : b->tnorevsorted ? "!r" : "",              \
        b->tkey ? "K" : b->tnokey[1] ? "!k" : "",                       \
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -577,30 +577,28 @@ oidtostr(oid i, char *p, size_t len)
 static gdk_return
 infoHeap(BAT *bk, BAT *bv, Heap *hp, const char *nme)
 {
-       char buf[1024], *p = buf;
+       char kbuf[32], vbuf[32];
 
        if (!hp)
                return GDK_SUCCEED;
-       while (*nme)
-               *p++ = *nme++;
-       strcpy(p, "free");
-       if (BUNappend(bk, buf, false) != GDK_SUCCEED ||
-               BUNappend(bv, local_utoa(hp->free, buf), false) != GDK_SUCCEED)
+       strconcat_len(kbuf, sizeof(kbuf), nme, "free", NULL);
+       if (BUNappend(bk, kbuf, false) != GDK_SUCCEED ||
+               BUNappend(bv, local_utoa(hp->free, vbuf), false) != GDK_SUCCEED)
                return GDK_FAIL;
-       strcpy(p, "size");
-       if (BUNappend(bk, buf, false) != GDK_SUCCEED ||
-               BUNappend(bv, local_utoa(hp->size, buf), false) != GDK_SUCCEED)
+       strconcat_len(kbuf, sizeof(kbuf), nme, "size", NULL);
+       if (BUNappend(bk, kbuf, false) != GDK_SUCCEED ||
+               BUNappend(bv, local_utoa(hp->size, vbuf), false) != GDK_SUCCEED)
                return GDK_FAIL;
-       strcpy(p, "storage");
-       if (BUNappend(bk, buf, false) != GDK_SUCCEED ||
+       strconcat_len(kbuf, sizeof(kbuf), nme, "storage", NULL);
+       if (BUNappend(bk, kbuf, false) != GDK_SUCCEED ||
                BUNappend(bv, (hp->base == NULL || hp->base == (char *) 1) ? 
"absent" : (hp->storage == STORE_MMAP) ? (hp-> filename [0] ? "memory mapped" : 
"anonymous vm") : (hp->storage == STORE_PRIV) ? "private map" : "malloced", 
false) != GDK_SUCCEED)
                return GDK_FAIL;
-       strcpy(p, "newstorage");
-       if (BUNappend(bk, buf, false) != GDK_SUCCEED ||
+       strconcat_len(kbuf, sizeof(kbuf), nme, "newstorage", NULL);
+       if (BUNappend(bk, kbuf, false) != GDK_SUCCEED ||
                BUNappend(bv, (hp->newstorage == STORE_MEM) ? "malloced" : 
(hp->newstorage == STORE_PRIV) ? "private map" : "memory mapped", false) != 
GDK_SUCCEED)
                return GDK_FAIL;
-       strcpy(p, "filename");
-       if (BUNappend(bk, buf, false) != GDK_SUCCEED ||
+       strconcat_len(kbuf, sizeof(kbuf), nme, "filename", NULL);
+       if (BUNappend(bk, kbuf, false) != GDK_SUCCEED ||
                BUNappend(bv, hp->filename[0] ? hp->filename : "no file",
                                  false) != GDK_SUCCEED)
                return GDK_FAIL;
@@ -764,12 +762,13 @@ BKCinfo(bat *ret1, bat *ret2, const bat 
                || BUNappend(bk, "batCopiedtodisk", false) != GDK_SUCCEED
                || BUNappend(bv, local_itoa((ssize_t) bi.copiedtodisk, buf),
                                         false) != GDK_SUCCEED
-               || BUNappend(bk, "theap.dirty", false) != GDK_SUCCEED
+               || BUNappend(bk, "tail.dirty", false) != GDK_SUCCEED
                || BUNappend(bv, bi.hdirty ? "dirty" : "clean", false) != 
GDK_SUCCEED
                || infoHeap(bk, bv, bi.h, "tail.") != GDK_SUCCEED
-               || BUNappend(bk, "tvheap->dirty", false) != GDK_SUCCEED
-               || BUNappend(bv, bi.vhdirty ? "dirty" : "clean", false) != 
GDK_SUCCEED
-               || infoHeap(bk, bv, bi.vh, "theap.") != GDK_SUCCEED) {
+               || (bi.vh
+                       && (BUNappend(bk, "tvheap.dirty", false) != GDK_SUCCEED
+                               || BUNappend(bv, bi.vhdirty ? "dirty" : 
"clean", false) != GDK_SUCCEED
+                               || infoHeap(bk, bv, bi.vh, "tvheap.") != 
GDK_SUCCEED))) {
                bat_iterator_end(&bi);
                BBPreclaim(bk);
                BBPreclaim(bv);
diff --git a/monetdb5/modules/mal/bbp.c b/monetdb5/modules/mal/bbp.c
--- a/monetdb5/modules/mal/bbp.c
+++ b/monetdb5/modules/mal/bbp.c
@@ -39,7 +39,7 @@ CMDbbpbind(Client cntxt, MalBlkPtr mb, M
        BAT *b;
 
        (void) cntxt;
-       (void) mb;                                      /* fool compiler */
+       (void) mb;
        lhs = &stk->stk[pci->argv[0]];
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to