Changeset: ad8288f5ec33 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ad8288f5ec33
Branch: Oct2020
Log Message:

merged


diffs (truncated from 1157 to 300 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -1746,9 +1746,6 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
        lwidth = l->twidth;
        rwidth = r->twidth;
 
-       /* basic properties will be adjusted if necessary later on,
-        * they were initially set by joininitresults() */
-
        if (not_in && rci->ncand > 0 && !r->tnonil &&
            ((BATtvoid(l) && l->tseqbase == oid_nil) ||
             (BATtvoid(r) && r->tseqbase == oid_nil) ||
@@ -1781,14 +1778,23 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
        BAT *r2 = r2p ? *r2p : NULL;
 
        if (l->tsorted || l->trevsorted) {
-               /* determine opportunistic scan window for l */
-               for (nl = lci->ncand, lscan = 4; nl > 0; lscan++)
-                       nl >>= 1;
                equal_order = (l->tsorted && r->tsorted) ||
                        (l->trevsorted && r->trevsorted &&
                         !BATtvoid(l) && !BATtvoid(r));
                lordering = l->tsorted && (r->tsorted || !equal_order) ? 1 : -1;
                rordering = equal_order ? lordering : -lordering;
+               if (!l->tnonil && !nil_matches && !nil_on_miss) {
+                       nl = binsearch(NULL, 0, l->ttype, lvals, lvars, lwidth, 
0, BATcount(l), nil, lordering, 1);
+                       nl = canditer_search(lci, nl + l->hseqbase, true);
+                       if (l->tsorted) {
+                               canditer_setidx(lci, nl);
+                       } else if (l->trevsorted) {
+                               lci->ncand = nl;
+                       }
+               }
+               /* determine opportunistic scan window for l */
+               for (nl = lci->ncand, lscan = 4; nl > 0; lscan++)
+                       nl >>= 1;
        } else {
                /* if l not sorted, we will always use binary search
                 * on r */
@@ -2246,7 +2252,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
                                /* keyness or r2 can only be assured
                                 * as long as matched values are
                                 * ordered */
-                               int ord = rordering * cmp(prev, v);
+                               int ord = rordering * cmp(prev, v ? v : nil);
                                if (ord < 0) {
                                        /* previous value in l was
                                         * less than current */
@@ -2270,7 +2276,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
                                        }
                                }
                        }
-                       prev = v;
+                       prev = v ? v : nil;
                }
                if (BATcount(r1) > 0) {
                        /* a new, higher value will be inserted into
@@ -3522,7 +3528,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
        lcnt = canditer_init(&lci, l, sl);
        rcnt = canditer_init(&rci, r, sr);
 
-       if (lcnt == 0 || (!only_misses && !nil_on_miss && rcnt == 0)) {
+       if (lcnt == 0 || rcnt == 0) {
                TRC_DEBUG(ALGO, "%s(l=" ALGOBATFMT ","
                          "r=" ALGOBATFMT ",sl=" ALGOOPTBATFMT ","
                          "sr=" ALGOOPTBATFMT ",nil_matches=%d,"
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -640,6 +640,7 @@ str runMALsequence(Client cntxt, MalBlkP
                        if (pci->fcn == NULL) {
                                ret = createException(MAL,"mal.interpreter", 
"address of pattern %s.%s missing", pci->modname, pci->fcnname);
                        } else {
+                               TRC_DEBUG(ALGO, "calling %s.%s\n", pci->modname 
? pci->modname : "<null>", pci->fcnname ? pci->fcnname : "<null>");
                                ret = (*pci->fcn)(cntxt, mb, stk, pci);
 #ifndef NDEBUG
                                if (ret == MAL_SUCCEED) {
@@ -667,6 +668,7 @@ str runMALsequence(Client cntxt, MalBlkP
                        }
                        break;
                case CMDcall:
+                       TRC_DEBUG(ALGO, "calling %s.%s\n", pci->modname ? 
pci->modname : "<null>", pci->fcnname ? pci->fcnname : "<null>");
                        ret = malCommandCall(stk, pci);
 #ifndef NDEBUG
                        if (ret == MAL_SUCCEED) {
diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -1,6 +1,6 @@
 HAVE_JDBCTESTS?JDBC_API_Tester
 #HAVE_JDBCTESTS?Test_Csendthread  # unfortunately has runtime-dependant output
 #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by 
default (it takes a long time to run and does not need to be run everytime, 
only before a new release)
+HAVE_JDBCCLIENT_JAR?Test_JdbcClient
 # next test should be done AFTER all the other tests have completed
-HAVE_JDBCCLIENT_JAR?Test_JdbcClient
 HAVE_JDBCCLIENT_JAR?ValidateSystemCatalogTables
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -350,7 +350,7 @@ query_exp_optname(sql_query *query, sql_
 }
 
 static sql_subfunc *
-bind_func_(mvc *sql, sql_schema *s, char *fname, list *ops, sql_ftype type)
+bind_func_(mvc *sql, sql_schema *s, char *fname, list *ops, sql_ftype type, 
bool *found)
 {
        sql_subfunc *sf = NULL;
 
@@ -359,13 +359,15 @@ bind_func_(mvc *sql, sql_schema *s, char
            execute_priv(sql, sql->forward) && type == sql->forward->type)
                return sql_dup_subfunc(sql->sa, sql->forward, NULL, NULL);
        sf = sql_bind_func_(sql->sa, s, fname, ops, type);
+       if (found)
+               *found |= sf != NULL;
        if (sf && execute_priv(sql, sf->func))
                return sf;
        return NULL;
 }
 
 static sql_subfunc *
-bind_func(mvc *sql, sql_schema *s, char *fname, sql_subtype *t1, sql_subtype 
*t2, sql_ftype type)
+bind_func(mvc *sql, sql_schema *s, char *fname, sql_subtype *t1, sql_subtype 
*t2, sql_ftype type, bool *found)
 {
        sql_subfunc *sf = NULL;
 
@@ -383,13 +385,15 @@ bind_func(mvc *sql, sql_schema *s, char 
                }
        }
        sf = sql_bind_func(sql->sa, s, fname, t1, t2, type);
+       if (found)
+               *found |= sf != NULL;
        if (sf && execute_priv(sql, sf->func))
                return sf;
        return NULL;
 }
 
 static sql_subfunc *
-bind_member_func(mvc *sql, sql_schema *s, char *fname, sql_subtype *t, int 
nrargs, sql_ftype type, sql_subfunc *prev)
+bind_member_func(mvc *sql, sql_schema *s, char *fname, sql_subtype *t, int 
nrargs, sql_ftype type, sql_subfunc *prev, bool *found)
 {
        sql_subfunc *sf = NULL;
 
@@ -397,19 +401,23 @@ bind_member_func(mvc *sql, sql_schema *s
                is_subtype(t, &((sql_arg *) sql->forward->ops->h->data)->type) 
&& execute_priv(sql, sql->forward) && type == sql->forward->type)
                return sql_dup_subfunc(sql->sa, sql->forward, NULL, t);
        sf = sql_bind_member(sql->sa, s, fname, t, type, nrargs, prev);
+       if (found)
+               *found |= sf != NULL;
        if (sf && execute_priv(sql, sf->func))
                return sf;
        return NULL;
 }
 
 static sql_subfunc *
-find_func(mvc *sql, sql_schema *s, char *fname, int len, sql_ftype type, 
sql_subfunc *prev )
+find_func(mvc *sql, sql_schema *s, char *fname, int len, sql_ftype type, 
sql_subfunc *prev, bool *found)
 {
        sql_subfunc *sf = NULL;
 
        if (sql->forward && strcmp(fname, sql->forward->base.name) == 0 && 
list_length(sql->forward->ops) == len && execute_priv(sql, sql->forward) && 
type == sql->forward->type)
                return sql_dup_subfunc(sql->sa, sql->forward, NULL, NULL);
        sf = sql_find_func(sql->sa, s, fname, len, type, prev);
+       if (found)
+               *found |= sf != NULL;
        if (sf && execute_priv(sql, sf->func))
                return sf;
        return NULL;
@@ -492,20 +500,24 @@ check_arguments_and_find_largest_any_typ
 sql_exp *
 find_table_function(mvc *sql, sql_schema *s, char *fname, list *exps, list 
*tl, sql_ftype type)
 {
-       sql_subfunc *f = bind_func_(sql, s, fname, tl, type);
+       bool found = false;
+       sql_subfunc *f = bind_func_(sql, s, fname, tl, type, &found);
 
        assert(type == F_UNION || type == F_LOADER);
        if (!f && list_length(tl)) {
                int len, match = 0;
                list *funcs = sql_find_funcs(sql->sa, s, fname, 
list_length(tl), type);
 
-               for (node *n = funcs->h; n ; ) { /* Reduce on privileges */
-                       sql_subfunc *sf = n->data;
-                       node *nn = n->next;
-
-                       if (!execute_priv(sql, sf->func))
-                               list_remove_node(funcs, n);
-                       n = nn;
+               if (!list_empty(funcs)) {
+                       found = true;
+                       for (node *n = funcs->h; n ; ) { /* Reduce on 
privileges */
+                               sql_subfunc *sf = n->data;
+                               node *nn = n->next;
+
+                               if (!execute_priv(sql, sf->func))
+                                       list_remove_node(funcs, n);
+                               n = nn;
+                       }
                }
                len = list_length(funcs);
                if (len > 1) {
@@ -530,7 +542,8 @@ find_table_function(mvc *sql, sql_schema
                        return NULL;
                return exp_op(sql->sa, exps, f);
        }
-       return sql_error(sql, 02, SQLSTATE(42000) "SELECT: no such %s function 
'%s'", type == F_UNION ? "table returning" : "loader", fname);
+       return sql_error(sql, 02, SQLSTATE(42000) "SELECT: %s %s function 
'%s'", found ? "insufficient privileges for" : "no such",
+                                        type == F_UNION ? "table returning" : 
"loader", fname);
 }
 
 static sql_rel *
@@ -651,15 +664,17 @@ rel_named_table_function(sql_query *quer
 static sql_exp *
 rel_op_(mvc *sql, sql_schema *s, char *fname, exp_kind ek)
 {
+       bool found = false;
        sql_subfunc *f = NULL;
        sql_ftype type = (ek.card == card_loader)?F_LOADER:((ek.card == 
card_none)?F_PROC:
                   ((ek.card == card_relation)?F_UNION:F_FUNC));
 
-       if ((f = bind_func_(sql, s, fname, NULL, type)) && check_card(ek.card, 
f)) {
-               return exp_op(sql->sa, NULL, f);
-       } else {
-               return sql_error(sql, 02, SQLSTATE(42000) "SELECT: no such 
operator '%s'", fname);
-       }
+       if ((f = bind_func_(sql, s, fname, NULL, type, &found))) {
+               if (check_card(ek.card, f))
+                       return exp_op(sql->sa, NULL, f);
+               found = false;
+       }
+       return sql_error(sql, 02, SQLSTATE(42000) "SELECT: %s operator '%s'", 
found ? "insufficient privileges for" : "no such", fname);
 }
 
 static sql_exp*
@@ -1447,6 +1462,7 @@ rel_filter(mvc *sql, sql_rel *rel, list 
        sql_subfunc *f = NULL;
        sql_schema *s = cur_schema(sql);
        list *tl = sa_list(sql->sa);
+       bool found = false;
 
        for (n = l->h; n; n = n->next){
                sql_exp *e = n->data;
@@ -1461,8 +1477,8 @@ rel_filter(mvc *sql, sql_rel *rel, list 
        if (sname && !(s = mvc_bind_schema(sql, sname)))
                return sql_error(sql, 02, SQLSTATE(3F000) "SELECT: no such 
schema '%s'", sname);
        /* find filter function */
-       if (!(f = bind_func_(sql, s, filter_op, tl, F_FILT)))
-               f = find_func(sql, s, filter_op, list_length(tl), F_FILT, NULL);
+       if (!(f = bind_func_(sql, s, filter_op, tl, F_FILT, &found)))
+               f = find_func(sql, s, filter_op, list_length(tl), F_FILT, NULL, 
&found);
        if (f) {
                node *n,*m = f->func->ops->h;
                list *nexps = sa_list(sql->sa);
@@ -1490,7 +1506,7 @@ rel_filter(mvc *sql, sql_rel *rel, list 
                r = nexps;
        }
        if (!f)
-               return sql_error(sql, 02, SQLSTATE(42000) "SELECT: no such 
FILTER function '%s'", filter_op);
+               return sql_error(sql, 02, SQLSTATE(42000) "SELECT: %s FILTER 
function '%s'", found ? "insufficient privileges for" : "no such", filter_op);
        e = exp_filter(sql->sa, l, r, f, anti);
 
        if (exps_one_is_rel(l) || exps_one_is_rel(r)) /* uncorrelated subquery 
case */
@@ -1727,19 +1743,23 @@ static sql_exp*
        int table_func = (ek.card == card_relation);
        sql_ftype type = (ek.card == card_loader)?F_LOADER:((ek.card == 
card_none)?F_PROC:
                   ((ek.card == card_relation)?F_UNION:F_FUNC));
-
-       f = bind_func_(sql, s, fname, tl, type);
+       bool found = false;
+
+       f = bind_func_(sql, s, fname, tl, type, &found);
        if (!f && list_length(tl)) {
                int len, match = 0;
                list *funcs = sql_find_funcs(sql->sa, s, fname, 
list_length(tl), type);
 
-               for (node *n = funcs->h; n ; ) { /* Reduce on privileges */
-                       sql_subfunc *sf = n->data;
-                       node *nn = n->next;
-
-                       if (!execute_priv(sql, sf->func))
-                               list_remove_node(funcs, n);
-                       n = nn;
+               if (!list_empty(funcs)) {
+                       found = true;
+                       for (node *n = funcs->h; n ; ) { /* Reduce on 
privileges */
+                               sql_subfunc *sf = n->data;
+                               node *nn = n->next;
+
+                               if (!execute_priv(sql, sf->func))
+                                       list_remove_node(funcs, n);
+                               n = nn;
+                       }
                }
                len = list_length(funcs);
                if (len > 1) {
@@ -1764,7 +1784,7 @@ static sql_exp*
                        return NULL;
                return exp_op(sql->sa, exps, f);
        }
-       return sql_error(sql, 02, SQLSTATE(42000) "SELECT: no such operator 
'%s'", fname);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to