Changeset: 46c8b0bfab74 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=46c8b0bfab74 Modified Files: monetdb5/mal/mal_client.c sql/server/rel_dump.c sql/server/rel_optimizer.c sql/server/rel_rel.c Branch: Jul2017 Log Message:
fixed problem in rel_read, now we also set the type of the projection columns in a set operator. For the op_table operator we now handle the type 2, case (trigger related function calls) everywhere in the code. diffs (113 lines): diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c --- a/monetdb5/mal/mal_client.c +++ b/monetdb5/mal/mal_client.c @@ -334,9 +334,6 @@ MCforkClient(Client father) GDKfree(son->prompt); son->prompt = GDKstrdup(father->prompt); son->promptlength = strlen(father->prompt); - /* reuse the scopes wherever possible */ - if (son->nspace == 0) - son->nspace = newModule(NULL, putName("child")); } return son; } diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -1081,6 +1081,22 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re return exp; } +static int +rel_set_types(mvc *sql, sql_rel *rel) +{ + list *iexps = rel_projections( sql, rel->l, NULL, 0, 1); + node *n, *m; + + if (!iexps || list_length(iexps) >= list_length(rel->exps)) + return -1; + for(n=iexps->h, m=rel->exps->h; n && m; n = n->next, m = m->next) { + sql_exp *e = m->data; + + e->tpe = *exp_subtype( n->data ); + } + return 0; +} + sql_rel* rel_read(mvc *sql, char *r, int *pos, list *refs) { @@ -1387,9 +1403,13 @@ rel_read(mvc *sql, char *r, int *pos, li (*pos)++; skipWS(r, pos); - exps = read_exps(sql, lrel, rrel, NULL, r, pos, '[', 0); + exps = read_exps(sql, NULL, NULL, NULL, r, pos, '[', 0); rel = rel_setop(sql->sa, lrel, rrel, j); + if (!exps) + return NULL; rel->exps = exps; + if (rel_set_types(sql, rel) < 0) + return NULL; set_processed(rel); return rel; case 'd': diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -5837,7 +5837,7 @@ rel_mark_used(mvc *sql, sql_rel *rel, in case op_basetable: case op_table: - if (rel->op == op_table && rel->l) { + if (rel->op == op_table && rel->l && rel->flag != 2) { rel_used(rel); if (rel->r) exp_mark_used(rel->l, rel->r); @@ -6086,7 +6086,7 @@ rel_dce_refs(mvc *sql, sql_rel *rel) case op_groupby: case op_select: - if (rel->l) + if (rel->l && (rel->op != op_table || rel->flag != 2)) l = rel_dce_refs(sql, rel->l); case op_basetable: @@ -6150,7 +6150,7 @@ rel_dce_down(mvc *sql, sql_rel *rel, lis case op_basetable: case op_table: - if (skip_proj && rel->l && rel->op == op_table) + if (skip_proj && rel->l && rel->op == op_table && rel->flag != 2) rel->l = rel_dce_down(sql, rel->l, refs, 0); if (!skip_proj) rel_dce_sub(sql, rel, refs); @@ -8316,7 +8316,7 @@ rel_apply_rename(mvc *sql, sql_rel *rel) case op_basetable: return rel; case op_table: - if (rel->l) + if (rel->l && rel->flag != 2) rel->l = rel_apply_rename(sql, rel->l); return rel; case op_project: @@ -8483,7 +8483,7 @@ rel_apply_rewrite(int *changes, mvc *sql return l; } /* table function (TODO should output any input cols) */ - if (r->op == op_table && r->l) { + if (r->op == op_table && r->l && rel->flag != 2) { assert(0); r->l = rel->l; return r; diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c --- a/sql/server/rel_rel.c +++ b/sql/server/rel_rel.c @@ -104,6 +104,7 @@ rel_copy( sql_allocator *sa, sql_rel *i rel->l = NULL; rel->r = NULL; rel->card = i->card; + rel->flag = i->flag; switch(i->op) { case op_basetable: _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list