Changeset: 542e33c27a7b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/542e33c27a7b
Modified Files:
        gdk/gdk_private.h
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/optimizer/opt_matpack.c
Branch: default
Log Message:

Merge with Mar2025 branch.


diffs (truncated from 735 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_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]];
        name = *getArgReference_str(stk, pci, 1);
        if (name == NULL || isIdentifier(name) < 0)
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -177,7 +177,7 @@ CLTquit(Client cntxt, MalBlkPtr mb, MalS
 {
        str msg = MAL_SUCCEED;
        int idx = cntxt->idx;
-       (void) mb;                                      /* fool compiler */
+       (void) mb;
 
        if (pci->argc == 2) {
                if (cntxt->user == MAL_ADMIN)
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -986,7 +986,7 @@ SERVERstop(void *ret)
         * system is going down */
        while (ATOMIC_GET(&nlistener) > 0 && !GDKexiting())
                MT_sleep_ms(100);
-       (void) ret;                                     /* fool compiler */
+       (void) ret;
        return MAL_SUCCEED;
 }
 
diff --git a/monetdb5/modules/mal/mdb.c b/monetdb5/modules/mal/mdb.c
--- a/monetdb5/modules/mal/mdb.c
+++ b/monetdb5/modules/mal/mdb.c
@@ -231,7 +231,7 @@ MDBStkDepth(Client cntxt, MalBlkPtr mb, 
        int *ret = getArgReference_int(s, p, 0);
 
        (void) cntxt;
-       (void) mb;                                      /* fool compiler */
+       (void) mb;
        *ret = getStkDepth(s);
        return MAL_SUCCEED;
 }
@@ -449,7 +449,7 @@ MDBlist3(Client cntxt, MalBlkPtr mb, Mal
        if (s == NULL)
                throw(MAL, "mdb.list", "Could not find %s.%s", modnme, fcnnme);
        printFunction(cntxt->fdout, s->def, 0, LIST_MAL_NAME);
-       (void) mb;                                      /* fool compiler */
+       (void) mb;
        return MAL_SUCCEED;
 }
 
@@ -473,7 +473,7 @@ MDBlist3Detail(Client cntxt, MalBlkPtr m
        if (s == NULL)
                throw(MAL, "mdb.list", "Could not find %s.%s", modnme, fcnnme);
        printFunction(cntxt->fdout, s->def, 0, LIST_MAL_DEBUG);
-       (void) mb;                                      /* fool compiler */
+       (void) mb;
        return NULL;
 }
 
diff --git a/monetdb5/modules/mal/profiler.c b/monetdb5/modules/mal/profiler.c
--- a/monetdb5/modules/mal/profiler.c
+++ b/monetdb5/modules/mal/profiler.c
@@ -115,7 +115,7 @@ CMDstopTrace(Client cntxt, MalBlkPtr mb,
 static str
 CMDnoopProfiler(void *res)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to