Changeset: 15a57433d161 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/15a57433d161 Modified Files: sql/server/rel_rel.c Branch: balanced_union Log Message:
Process op_munion with other set ops in _rel_projections diffs (91 lines): 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 @@ -1293,6 +1293,7 @@ list * case op_union: case op_except: case op_inter: + case op_munion: if (is_basetable(rel->op) && !rel->exps) return rel_base_projection(sql, rel, intern); if (rel->exps) { @@ -1315,6 +1316,40 @@ list * } return exps; } + /* differentiate for the munion set op (for now) */ + if (is_munion(rel->op)) { + assert(rel->l); + /* get the exps from the first relation */ + rels = rel->l; + if (rels->h) + r = rels->h->data; + if (r) + exps = _rel_projections(sql, r, tname, settname, intern, basecol); + /* for every other relation in the list */ + // TODO: do we need the assertion here? for no-assert the loop is no-op + for (node *n = rels->h->next; n; n = n->next) { + rexps = _rel_projections(sql, n->data, tname, settname, intern, basecol); + assert(list_length(exps) == list_length(rexps)); + } + /* it's a multi-union (expressions have to be the same in all the operands) + * so we are ok only with the expressions of the first operand + */ + if (exps) { + int label = 0; + if (!settname) + label = ++sql->label; + for (node *en = exps->h; en; en = en->next) { + sql_exp *e = en->data; + + e->card = rel->card; + if (!settname) /* noname use alias */ + exp_setrelname(sql->sa, e, label); + } + if (!settname) + list_hash_clear(rel->l); + } + return exps; + } /* I only expect set relations to hit here */ assert(is_set(rel->op)); lexps = _rel_projections(sql, rel->l, tname, settname, intern, basecol); @@ -1336,38 +1371,7 @@ list * list_hash_clear(lexps); } return lexps; - case op_munion: - assert(rel->l); - /* get the exps from the first relation */ - rels = rel->l; - if (rels->h) - r = rels->h->data; - if (r) - exps = _rel_projections(sql, r, tname, settname, intern, basecol); - /* for every other relation in the list */ - // TODO: do we need the assertion here? for no-assert the loop is no-op - for (node *n = rels->h->next; n; n = n->next) { - rexps = _rel_projections(sql, n->data, tname, settname, intern, basecol); - assert(list_length(exps) == list_length(rexps)); - } - /* it's a multi-union (expressions have to be the same in all the operands) - * so we are ok only with the expressions of the first operand - */ - if (exps) { - int label = 0; - if (!settname) - label = ++sql->label; - for (node *en = exps->h; en; en = en->next) { - sql_exp *e = en->data; - e->card = rel->card; - if (!settname) /* noname use alias */ - exp_setrelname(sql->sa, e, label); - } - if (!settname) - list_hash_clear(rel->l); - } - return exps; case op_ddl: case op_semi: case op_anti: _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org