Changeset: 569f46fa28e4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/569f46fa28e4
Modified Files:
        sql/backends/monet5/sql.c
Branch: resource_management
Log Message:

merge with upstream


diffs (truncated from 2775 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -902,6 +902,7 @@ const char dblRef[];
 void debugFunction(stream *fd, MalBlkPtr mb, MalStkPtr stk, int flg, int 
first, int size);
 const char decompressRef[];
 int defConstant(MalBlkPtr mb, int type, ValPtr cst);
+const char defaultfastRef[];
 const char defineRef[];
 void delArgument(InstrPtr p, int varid);
 const char deleteRef[];
@@ -1430,13 +1431,6 @@ char *UDFfuse_int_lng(lng *ret, const in
 char *UDFfuse_lng_hge(hge *ret, const lng *one, const lng *two);
 char *UDFfuse_sht_int(int *ret, const sht *one, const sht *two);
 str UDFreverse(str *ret, const str *arg);
-str VLTgenerator_join(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str VLTgenerator_noop(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str VLTgenerator_projection(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
-str VLTgenerator_rangejoin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-str VLTgenerator_subselect(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-str VLTgenerator_table(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-str VLTgenerator_thetasubselect(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 str append_to_table_from_emit(Client cntxt, char *sname, char *tname, 
sql_emit_col *columns, size_t ncols);
 str batbte_dec2_bte(bat *res, const int *s1, const bat *v, const bat *sid);
 str batbte_dec2_dbl(bat *res, const int *s1, const bat *v, const bat *sid);
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);
@@ -3764,12 +3770,13 @@ main(int argc, char **argv)
        mapi_setfilecallback2(mid, getfile, putfile, &priv);
 
        mapi_trace(mid, trace);
+       if (!has_fileargs && command == NULL && isatty(fileno(stdin)))
+               catch_interrupts(mid);
+
        /* 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);
-
                if (mode == SQL) {
                        lang = "/SQL";
                } else {
diff --git a/clients/odbc/tests/ODBCmetadata.c 
b/clients/odbc/tests/ODBCmetadata.c
--- a/clients/odbc/tests/ODBCmetadata.c
+++ b/clients/odbc/tests/ODBCmetadata.c
@@ -1535,7 +1535,7 @@ main(int argc, char **argv)
        compareResult(stmt, ret, "EXPLAIN SELECT * from odbctst.\"LINES\"",
            nrServerThreads > 1 ?
                "Resultset with 1 columns\n"
-               "Resultset with 46 rows\n"
+               "Resultset with 17 rows\n"
                "mal\n"
                "WLONGVARCHAR(174)\n"
                "function user.main():void;\n"
@@ -1553,13 +1553,10 @@ main(int argc, char **argv)
                "\n"
                "    X_37:int := sql.resultSet(X_38:bat[:str], X_39:bat[:str], 
X_40:bat[:str], X_41:bat[:int], X_42:bat[:int], X_33:bat[:int], X_34:bat[:int], 
X_35:bat[:int], X_36:bat[:int]);\n"
                "end user.main;\n"
-               "\n\n\n\n\n\n\n\n\n\n"
-               "\n\n\n\n\n\n\n\n\n\n"
-               "\n\n\n\n\n\n\n\n\n\n"
-               "\n"
+               "\n\n"
            :
                "Resultset with 1 columns\n"
-               "Resultset with 44 rows\n"
+               "Resultset with 15 rows\n"
                "mal\n"
                "WLONGVARCHAR(174)\n"
                "function user.main():void;\n"
@@ -1575,10 +1572,7 @@ main(int argc, char **argv)
                "    X_42:bat[:int] := bat.pack(0:int, 0:int, 0:int, 3:int);\n"
                "    X_37:int := sql.resultSet(X_38:bat[:str], X_39:bat[:str], 
X_40:bat[:str], X_41:bat[:int], X_42:bat[:int], X_33:bat[:int], X_34:bat[:int], 
X_35:bat[:int], X_36:bat[:int]);\n"
                "end user.main;\n"
-               "\n\n\n\n\n\n\n\n\n\n"
-               "\n\n\n\n\n\n\n\n\n\n"
-               "\n\n\n\n\n\n\n\n\n\n"
-               "\n");
+               "\n\n");
 
        // test TRACE SELECT query.
        // This will return two resultsets: first with the query results and 
next with the trace results
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1515,11 +1515,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) {
@@ -1588,11 +1590,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;
        }
 }
 
@@ -1660,9 +1666,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_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -834,7 +834,8 @@ COLcopy(BAT *b, int tt, bool writable, r
                bn->tnil = bi.nil;
                bn->tminpos = bi.minpos;
                bn->tmaxpos = bi.maxpos;
-               bn->tunique_est = bi.unique_est;
+               if (!bi.key)
+                       bn->tunique_est = bi.unique_est;
        } else if (ATOMstorage(tt) == ATOMstorage(b->ttype) &&
                   ATOMcompare(tt) == ATOMcompare(b->ttype)) {
                BUN h = bi.count;
@@ -861,7 +862,8 @@ COLcopy(BAT *b, int tt, bool writable, r
                }
                bn->tminpos = bi.minpos;
                bn->tmaxpos = bi.maxpos;
-               bn->tunique_est = bi.unique_est;
+               if (!bi.key)
+                       bn->tunique_est = bi.unique_est;
        } else {
                bn->tsorted = bn->trevsorted = false; /* set based on count 
later */
                bn->tnonil = bn->tnil = false;
@@ -873,6 +875,7 @@ COLcopy(BAT *b, int tt, bool writable, r
                bn->tsorted = ATOMlinear(b->ttype);
                bn->trevsorted = ATOMlinear(b->ttype);
                bn->tkey = true;
+               bn->tunique_est = (double) bn->batCount;
        }
        bat_iterator_end(&bi);
        if (!writable)
@@ -1665,8 +1668,12 @@ BUNinplacemulti(BAT *b, const oid *posit
        BUN nunique = b->thash ? b->thash->nunique : 0;
        MT_rwlock_wrunlock(&b->thashlock);
        MT_lock_set(&b->theaplock);
-       if (nunique != 0)
+       if (nunique != 0) {
                b->tunique_est = (double) nunique;
+               if (nunique == b->batCount && !b->tkey)
+                       BATkey(b, true);
+       } else if (b->tkey)
+               b->tunique_est = (double) b->batCount;
        b->tminpos = bi.minpos;
        b->tmaxpos = bi.maxpos;
        b->theap->dirty = true;
@@ -1954,8 +1961,10 @@ BATkey(BAT *b, bool flag)
        b->tkey = flag;
        if (!flag) {
                b->tseqbase = oid_nil;
-       } else
+       } else {
                b->tnokey[0] = b->tnokey[1] = 0;
+               b->tunique_est = (double) b->batCount;
+       }
        gdk_return rc = GDK_SUCCEED;
        if (flag && VIEWtparent(b)) {
                /* if a view is key, then so is the parent if the two
@@ -2021,6 +2030,7 @@ BATtseqbase(BAT *b, oid o)
                                b->trevsorted = b->batCount <= 1;
                                if (!b->trevsorted)
                                        b->tnorevsorted = 1;
+                               b->tunique_est = (double) b->batCount;
                        }
                }
        } else {
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_cand.c b/gdk/gdk_cand.c
--- a/gdk/gdk_cand.c
+++ b/gdk/gdk_cand.c
@@ -1469,6 +1469,7 @@ BATmaskedcands(oid hseq, BUN nr, BAT *ma
                GDKfree(msks);
        }
        BATsetcount(bn, cnt);
+       bn->tunique_est = (double) cnt;
        TRC_DEBUG(ALGO, "hseq=" OIDFMT ", masked=" ALGOBATFMT ", selected=%s"
                  " -> " ALGOBATFMT "\n",
                  hseq, ALGOBATPAR(masked),
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;          \
                                        }                               \
                                }                                       \
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to