Changeset: a6b08f4c6260 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a6b08f4c6260 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c Branch: Jun2020 Log Message:
make sure we also set the used candidates in none reducing compare functions (e_cmp type) also do the candidate handleing in the batcalc.between (ie sql_statement.c). diffs (93 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -1085,10 +1085,18 @@ exp_bin(backend *be, sql_exp *e, stmt *l s = stmt_binop(be, stmt_binop(be, l, r, lf), stmt_binop(be, l, r2, rf), a); + if (l->cand) + s->cand = l->cand; + if (r->cand) + s->cand = r->cand; + if (r2->cand) + s->cand = r2->cand; } if (is_anti(e)) { + stmt *cand = s->cand; sql_subfunc *a = sql_bind_func(sql->sa, sql->session->schema, "not", bt, NULL, F_FUNC); s = stmt_unop(be, s, a); + s->cand = cand; } #if 0 } else if (((e->flag&3) != 3) /* both sides closed use between implementation */ && l->nrcols > 0 && r->nrcols > 0 && r2->nrcols > 0) { @@ -1096,6 +1104,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l stmt_uselect(be, l, r2, range2rcompare(e->flag), sel, is_anti(e), 0), is_anti(e), 0); #endif } else { + /* done in stmt_uselect2 if (sel && ((l->cand && l->nrcols) || (r->cand && r->nrcols) || (r2->cand && r->nrcols))) { if (!l->cand && l->nrcols) l = stmt_project(be, sel, l); @@ -1105,6 +1114,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l r2 = stmt_project(be, sel, r2); sel = NULL; } + */ if (l->nrcols == 0) l = stmt_const(be, bin_first_column(be, left), l); s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e)); @@ -1118,6 +1128,10 @@ exp_bin(backend *be, sql_exp *e, stmt *l sql_subfunc *f = sql_bind_func(sql->sa, sql->session->schema, in_flag?"=":"<>", tail_type(l), tail_type(l), F_FUNC); assert(f); s = stmt_binop(be, l, r, f); + if (l->cand) + s->cand = l->cand; + if (r->cand) + s->cand = r->cand; } else if (!reduce || (l->nrcols == 0 && r->nrcols == 0)) { sql_subfunc *f = sql_bind_func(sql->sa, sql->session->schema, compare_func((comp_type)e->flag, is_anti(e)), @@ -1137,6 +1151,10 @@ exp_bin(backend *be, sql_exp *e, stmt *l } else { s = stmt_binop(be, l, r, f); } + if (l->cand) + s->cand = l->cand; + if (r->cand) + s->cand = r->cand; } else { /* this can still be a join (as relational algebra and single value subquery results still means joins */ s = stmt_uselect(be, l, r, (comp_type)e->flag, sel, is_anti(e), is_semantics(e)); diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -1622,11 +1622,28 @@ select2_join2(backend *be, stmt *op1, st if (op2->nr < 0 || op3->nr < 0) return NULL; - p = newStmt(mb, batcalcRef, betweenRef); p = pushArgument(mb, p, l); p = pushArgument(mb, p, op2->nr); p = pushArgument(mb, p, op3->nr); + + /* cands */ + if (op1->cand || op2->cand || op3->cand) { /* some already handled the previous selection */ + if (op1->cand && op1->nrcols) + p = pushNil(mb, p, TYPE_bat); + else if (op1->nrcols) + p = pushArgument(mb, p, sub->nr); + if (op2->cand) + p = pushNil(mb, p, TYPE_bat); + else if (op2->nrcols) + p = pushArgument(mb, p, sub->nr); + if (op3->cand) + p = pushNil(mb, p, TYPE_bat); + else if (op3->nrcols) + p = pushArgument(mb, p, sub->nr); + sub = NULL; + } + p = pushBit(mb, p, (cmp & CMP_SYMMETRIC) != 0); /* symmetric */ p = pushBit(mb, p, (cmp & 1) != 0); /* lo inclusive */ p = pushBit(mb, p, (cmp & 2) != 0); /* hi inclusive */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list