Changeset: 10208f591afe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/10208f591afe
Modified Files:
sql/backends/monet5/sql.c
sql/server/rel_optimizer.c
Branch: pushcands
Log Message:
merged
diffs (truncated from 1411 to 300 lines):
diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -1245,7 +1245,6 @@ retryRead:
case 'L':
case 'l': /* list the current MAL block or module */
{
- Symbol fs;
int lstng;
lstng = LIST_MAL_NAME;
@@ -1254,52 +1253,25 @@ retryRead:
skipWord(cntxt, b);
skipBlanc(cntxt, b);
if (*b != 0) {
- /* debug the current block */
+ /* debug the block context */
MalBlkPtr m = mdbLocateMalBlk(cntxt, mb, b);
+ mnstr_printf(out, "#Inspect %s\n", b);
- if ( m == 0)
- m = mb;
- if ( m ){
- const char *nme =
getFunctionId(mb->stmt[0]);
- str s = strstr(b, nme);
- if( s ){
- b = s + strlen(nme);
- skipBlanc(cntxt,b);
- }
- }
- if (isdigit((unsigned char) *b) || *b == '-' ||
*b == '+')
- goto partial;
+ if ( m )
+ mb = m;
- /* inspect another function */
- if( strchr(b,'.') ){
- str modnme = b;
- str fcnnme;
- fcnnme = strchr(b,'.');
- *fcnnme++ = 0;
- b = fcnnme;
- skipNonBlanc(cntxt, b);
- if ( b)
- *b++ = 0;
-
- fs = findSymbol(cntxt->usermodule,
putName(modnme),putName(fcnnme));
- if (fs == 0) {
- mnstr_printf(out, "#'%s' not
found\n", modnme);
- continue;
- }
- for(; fs; fs = fs->peer)
- if( strcmp(fcnnme, fs->name)==0) {
- if( lstng == LIST_MAL_NAME)
- printFunction(out,
fs->def, 0, lstng);
- else
- debugFunction(out,
fs->def, 0, lstng, 0,mb->stop);
- }
- continue;
+ skipWord(cntxt, b);
+ skipBlanc(cntxt, b);
+ c = strchr(b,'.');
+ if( c){
+ b = c + 1;
+ skipWord(cntxt, b);
+ skipBlanc(cntxt, b);
}
- if (m){
- if( lstng == LIST_MAL_NAME)
- printFunction(out, m, 0, lstng);
- else
- debugFunction(out, m, 0, lstng,
0,m->stop);
+ c = strchr(b,']');
+ if (c){
+ b = c + 1;
+ goto partial;
}
} else {
/*
@@ -1342,13 +1314,15 @@ partial:
skipWord(cntxt, b);
skipBlanc(cntxt, b);
if (*b) {
+ mnstr_printf(out, "#History of %s\n", b);
mdot = mdbLocateMalBlk(cntxt, mb, b);
if (mdot != NULL)
showMalBlkHistory(out, mdot);
else
mnstr_printf(out, "#'%s' not found\n",
b);
- } else
+ } else{
showMalBlkHistory(out, mb);
+ }
break;
}
case 'r': /* reset program counter */
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -413,7 +413,7 @@ debugFunction(stream *fd, MalBlkPtr mb,
if (p->token == REMsymbol)
mnstr_printf(fd,"%-40s\n",ps);
else {
- mnstr_printf(fd,"%-40s\t#[%d] ("BUNFMT") %s
",ps, i, getRowCnt(mb,getArg(p,0)), (p->blk? p->blk->binding:""));
+ mnstr_printf(fd,"%-40s\t#[%d] %s ",ps, i,
(p->blk? p->blk->binding:""));
if( flg & LIST_MAL_FLOW){
for(j =0; j < p->retc; j++)
mnstr_printf(fd,"%d
",getArg(p,j));
@@ -422,9 +422,6 @@ debugFunction(stream *fd, MalBlkPtr mb,
for(; j < p->argc; j++)
mnstr_printf(fd,"%d
",getArg(p,j));
}
- // also show type check property
- if( p->typechk == TYPE_UNKNOWN)
- mnstr_printf(fd," type check needed ");
mnstr_printf(fd,"\n");
}
GDKfree(ps);
diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog file for sql
# This file is updated with Maddlog
+* Wed Apr 28 2021 Pedro Ferreira <[email protected]>
+- Merge statements could not produce correct results on complex join
+ conditions, so a renovation was made. As a consequence, subqueries
+ now have to be disabled on merge join conditions.
+
* Tue Mar 16 2021 Pedro Ferreira <[email protected]>
- Use of CTEs inside UPDATE and DELETE statements are now more
restrict. Previously they could be used without any extra specification
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
@@ -386,7 +386,7 @@ subrel_project( backend *be, rel_bin_stm
s->cand = NULL;
list_append(l, s);
}
- s = create_rel_bin_stmt(be->mvc->sa, l, NULL, NULL, NULL, NULL);
+ s = create_rel_bin_stmt(be->mvc->sa, l, NULL);
stmt_set_nrcols(s);
if (rel && rel_is_ref(rel))
refs_update_stmt(refs, rel, s);
@@ -1219,7 +1219,7 @@ exp_bin(backend *be, sql_exp *e, rel_bin
r = stmt_fetch(be, r);
}
if (r->type == st_list)
- r = stmt_table(be,
create_rel_bin_stmt(sql->sa, r->op4.lval, NULL, NULL, NULL, NULL), 1);
+ r = stmt_table(be,
create_rel_bin_stmt(sql->sa, r->op4.lval, NULL), 1);
}
s = stmt_return(be, r, GET_PSM_LEVEL(e->flag));
} else if (e->flag & PSM_WHILE) {
@@ -1851,7 +1851,7 @@ rel2bin_sql_table(backend *be, sql_table
}
}
}
- return create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ return create_rel_bin_stmt(sql->sa, l, NULL);
}
static rel_bin_stmt *
@@ -1922,7 +1922,7 @@ rel2bin_basetable(backend *be, sql_rel *
s->cname = exp_name(exp);
list_append(l, s);
}
- return create_rel_bin_stmt(sql->sa, l, dels, NULL, NULL, NULL);
+ return create_rel_bin_stmt(sql->sa, l, dels);
}
static int
@@ -2038,6 +2038,7 @@ rel2bin_args(backend *be, sql_rel *rel,
case op_union:
case op_inter:
case op_except:
+ case op_merge:
args = rel2bin_args(be, rel->l, args);
args = rel2bin_args(be, rel->r, args);
break;
@@ -2105,7 +2106,7 @@ rel2bin_table(backend *be, sql_rel *rel,
assert(ti->type != 1);
}
}
- return create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ return create_rel_bin_stmt(sql->sa, l, NULL);
} else if (op) {
int i;
sql_subfunc *f = op->f;
@@ -2238,7 +2239,7 @@ rel2bin_table(backend *be, sql_rel *rel,
}
}
assert(rel->flag != TABLE_PROD_FUNC || !sub || !(sub->nrcols));
- sub = create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ sub = create_rel_bin_stmt(sql->sa, l, NULL);
} else if (rel->l) { /* handle sub query via function */
int i;
char name[16], *nme;
@@ -2265,7 +2266,7 @@ rel2bin_table(backend *be, sql_rel *rel,
s = stmt_fetch(be, s);
list_append(l, s);
}
- sub = create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ sub = create_rel_bin_stmt(sql->sa, l, NULL);
}
if (!sub) {
assert(sql->session->status == -10); /* Stack overflow errors
shouldn't terminate the server */
@@ -2555,8 +2556,8 @@ rel2bin_join(backend *be, sql_rel *rel,
list *l, *sexps = NULL;
node *en = NULL, *n;
rel_bin_stmt *left = NULL, *right = NULL;
- stmt *join = NULL, *jl, *jr, *ld = NULL, *rd = NULL;
- int need_left = (rel->flag == LEFT_JOIN);
+ stmt *join = NULL, *jl = NULL, *jr = NULL, *ld = NULL, *rd = NULL;
+ int need_left = (rel->flag & LEFT_JOIN);
assert(rel->l && rel->r);
left = subrel_bin(be, rel->l, refs); /* first construct the left sub
relation */
@@ -2674,7 +2675,7 @@ rel2bin_join(backend *be, sql_rel *rel,
s = stmt_alias(be, s, rnme, nme);
list_append(nl, s);
}
- sub = create_rel_bin_stmt(sql->sa, nl, NULL, NULL, NULL, NULL);
+ sub = create_rel_bin_stmt(sql->sa, nl, NULL);
/* continue with non equi-joins */
while(sexps) {
@@ -2755,7 +2756,7 @@ rel2bin_join(backend *be, sql_rel *rel,
s = stmt_alias(be, s, rnme, nme);
list_append(l, s);
}
- return create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ return create_rel_bin_join_stmt(sql->sa, left, right, l, NULL, jl, jr,
ld, rd);
}
static int
@@ -2837,7 +2838,7 @@ rel2bin_antijoin(backend *be, sql_rel *r
s = stmt_alias(be, s, rnme, nme);
list_append(l, s);
}
- return create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ return create_rel_bin_join_stmt(sql->sa, left, right, l, NULL, join,
NULL, NULL, NULL);
}
static rel_bin_stmt *
@@ -2847,7 +2848,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
list *l, *sexps = NULL;
node *en = NULL, *n;
rel_bin_stmt *left = NULL, *right = NULL;
- stmt *join = NULL, *jl, *jr, *c;
+ stmt *join = NULL, *jl = NULL, *jr = NULL, *c;
sql_rel *ll = rel->l;
int semijoin_only = 0, l_is_base = is_basetable(ll->op);
@@ -3011,7 +3012,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
s = stmt_alias(be, s, rnme, nme);
list_append(nl, s);
}
- sub = create_rel_bin_stmt(sql->sa, nl, NULL, NULL, NULL, NULL);
+ sub = create_rel_bin_stmt(sql->sa, nl, NULL);
/* continue with non equi-joins */
while(sexps) {
@@ -3068,7 +3069,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
s = stmt_alias(be, s, rnme, nme);
list_append(l, s);
}
- return create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ return create_rel_bin_join_stmt(sql->sa, left, right, l, NULL, join,
NULL, NULL, NULL);
}
static rel_bin_stmt *
@@ -3183,7 +3184,7 @@ rel2bin_union(backend *be, sql_rel *rel,
s = stmt_alias(be, s, rnme, nme);
list_append(l, s);
}
- sub = create_rel_bin_stmt(sql->sa, l, NULL, NULL, NULL, NULL);
+ sub = create_rel_bin_stmt(sql->sa, l, NULL);
sub = rel_rename(be, rel, sub);
if (need_distinct(rel))
@@ -3300,7 +3301,7 @@ rel2bin_except(backend *be, sql_rel *rel
c1 = stmt_alias(be, c1, rnme, nme);
list_append(stmts, c1);
}
- sub = create_rel_bin_stmt(sql->sa, stmts, NULL, NULL, NULL, NULL);
+ sub = create_rel_bin_stmt(sql->sa, stmts, NULL);
return rel_rename(be, rel, sub);
}
@@ -3397,7 +3398,7 @@ rel2bin_inter(backend *be, sql_rel *rel,
c1 = stmt_alias(be, c1, rnme, nme);
list_append(stmts, c1);
}
- sub = create_rel_bin_stmt(sql->sa, stmts, NULL, NULL, NULL, NULL);
+ sub = create_rel_bin_stmt(sql->sa, stmts, NULL);
return rel_rename(be, rel, sub);
}
@@ -3491,7 +3492,7 @@ rel2bin_project(backend *be, sql_rel *re
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list