Changeset: e722d65b90dd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e722d65b90dd
Modified Files:
        monetdb5/modules/mal/pp_hash.c
        sql/backends/monet5/rel_physical.c
        sql/backends/monet5/rel_pphash.c
Branch: manti
Log Message:

added one more condition to use manti: it only makes sense if there are multiple
'any' compare exps, i.e. don't use manti on is_samentics exps.

stmt_thetaselect needs ht_empty


diffs (95 lines):

diff --git a/monetdb5/modules/mal/pp_hash.c b/monetdb5/modules/mal/pp_hash.c
--- a/monetdb5/modules/mal/pp_hash.c
+++ b/monetdb5/modules/mal/pp_hash.c
@@ -2644,7 +2644,7 @@ _OAHASHomprobe(Client ctx, bat *PRB_oid,
        str err = NULL;
 
        assert(((single) && frequency) || !(single));
-       if (match_nulls) assert(any);
+       if (match_nulls) assert(any && !semantics);
 
        k = BATdescriptor(*PRB_key);
        t = BATdescriptor(*HSH_ht);
diff --git a/sql/backends/monet5/rel_physical.c 
b/sql/backends/monet5/rel_physical.c
--- a/sql/backends/monet5/rel_physical.c
+++ b/sql/backends/monet5/rel_physical.c
@@ -1005,7 +1005,14 @@ rel_pipeline(visitor *v, sql_rel *rel, b
                        list *eq_exps = sa_list(v->sql->sa);
                        list *other = sa_list(v->sql->sa);
                        /* manti: multi-column not-exist */
-                       bool manti = list_length(rel->attr) == 1 && 
list_length(rel->exps) > 1 && exp_is_atom(rel->attr->h->data) && 
!exp_is_true(rel->attr->h->data);
+                       int m_any = 0;
+
+                       if (list_length(rel->exps) > 1) {
+                               for (node *n = rel->exps->h; n; n = n->next)
+                                       m_any += (int)is_any((sql_exp*)n->data);
+                       }
+
+                       bool manti = list_length(rel->attr) == 1 && m_any > 1 
&& exp_is_atom(rel->attr->h->data) && !exp_is_true(rel->attr->h->data);
                        if (!list_empty(rel->attr))
                                rel->exps = get_simple_equi_joins_first(v->sql, 
rel, rel->exps);
                        split_join_exps(rel, eq_exps, other, true /* anti */, 
true /* eqonly */, false /* firstonly */);
diff --git a/sql/backends/monet5/rel_pphash.c b/sql/backends/monet5/rel_pphash.c
--- a/sql/backends/monet5/rel_pphash.c
+++ b/sql/backends/monet5/rel_pphash.c
@@ -53,6 +53,18 @@ _estimate(mvc *sql, sql_rel *rel)
        return est;
 }
 
+static int
+cnt_any(list *exps)
+{
+       int cnt = 0;
+       if (list_length(exps) > 1) {
+               for (node *n = exps->h; n; n = n->next) {
+                       cnt += (int)is_any((sql_exp*)n->data);
+               }
+       }
+       return cnt;
+}
+
 static stmt *
 _start_pp(backend *be, sql_rel *rel, bit buildphase, list *refs, stmt 
*shared_ht)
 {
@@ -519,7 +531,7 @@ rel2bin_oahash_equi_join(backend *be, sq
                sql_exp *e = rel->attr->h->data;
                if (exp_is_atom(e)) {
                mark = true;
-                               manti = !exp_is_true(rel->attr->h->data) && 
list_length(rel->exps) > 1;
+                               manti = !exp_is_true(rel->attr->h->data) && 
cnt_any(rel->exps) > 1;
                        }
                }
        }
@@ -921,7 +933,7 @@ rel2bin_oahash_groupjoin(backend *be, sq
                        mark = true;
                        if (exp_is_false(e)) {
                                exist = false;
-                               manti = list_length(rel->exps) > 1;
+                               manti = cnt_any(rel->exps) > 1;
                        }
                }
        }
@@ -1521,13 +1533,12 @@ rel2bin_oahash_semi(backend *be, sql_rel
        split_join_exps(rel, jexps, sexps, false /* anti */, true /* eqonly */, 
false /* firstonly */);
 
        bool anti = (list_length(jexps) == 1 && rel->op == op_anti);
-       bool manti = (list_length(jexps) > 1 && rel->op == op_anti);
        bool hf = false;
        if (list_empty(jexps)) { /* cartesian */
                stmt *stmts_ht = rel2bin_oahash_cart_build(be, rel, refs);
                sub = rel2bin_oahash_cart(be, rel, refs, stmts_ht, &probed_ids, 
&probe_sub, &probe_side, &hash_side, NULL, &hf);
        } else if (!list_empty(sexps)) {
-               sub = rel2bin_oahash_equi_join(be, rel, refs, jexps, 
&probed_ids, &probe_sub, &nulls, NULL /* prb_mrk */, NULL /* hsh_mrk */, 
&probe_side, &hash_side, true /* has_outerselect */, NULL, manti ? &ht_empty : 
NULL);
+               sub = rel2bin_oahash_equi_join(be, rel, refs, jexps, 
&probed_ids, &probe_sub, &nulls, NULL /* prb_mrk */, NULL /* hsh_mrk */, 
&probe_side, &hash_side, true /* has_outerselect */, NULL, &ht_empty);
        } else {
                assert(!list_empty(jexps) && list_length(jexps) == 
list_length(exps_cmp_prb));
                /* build-phase res: hash-table and hash-payload stmts */
@@ -1538,7 +1549,7 @@ rel2bin_oahash_semi(backend *be, sql_rel
                probe_sub = sub = _start_pp(be, rel_prb->l, false, refs, NULL);
                if (!sub) return NULL;
 
-               stmt *prb_res = hash_probe(be, rel, rel->exps, exps_cmp_prb, 
stmts_ht, sub, anti, false /* groupjoin */, false /* has_outerselect */, 
&nulls, NULL, NULL, manti ? &ht_empty : NULL);
+               stmt *prb_res = hash_probe(be, rel, rel->exps, exps_cmp_prb, 
stmts_ht, sub, anti, false /* groupjoin */, false /* has_outerselect */, 
&nulls, NULL, NULL, &ht_empty);
                if (prb_res == NULL) return NULL;
 
                /*** PROJECT RESULT PHASE ***/
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to