Changeset: 7ee1e1dc86d6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ee1e1dc86d6
Modified Files:
sql/src/server/rel_bin.mx
sql/src/server/sql_rel2bin.mx
Branch: Oct2010
Log Message:
implemented the handling of multiple join expressions were one was of type
joinN (ie like, general join)
diffs (57 lines):
diff -r 619a14401271 -r 7ee1e1dc86d6 sql/src/server/rel_bin.mx
--- a/sql/src/server/rel_bin.mx Wed Nov 10 14:27:39 2010 +0100
+++ b/sql/src/server/rel_bin.mx Wed Nov 10 15:43:21 2010 +0100
@@ -886,7 +886,7 @@
idx = 1;
if (!join) {
join = s;
- } else if (s->type != st_join && s->type != st_join2) {
+ } else if (s->type != st_join && s->type != st_join2 &&
s->type != st_joinN) {
/* handle select expressions */
/*assert(0);*/
if (s->h == join->h) {
diff -r 619a14401271 -r 7ee1e1dc86d6 sql/src/server/sql_rel2bin.mx
--- a/sql/src/server/sql_rel2bin.mx Wed Nov 10 14:27:39 2010 +0100
+++ b/sql/src/server/sql_rel2bin.mx Wed Nov 10 15:43:21 2010 +0100
@@ -751,6 +751,14 @@
}
static stmt *
+_project( stmt *o, stmt *v )
+{
+ if (v->nrcols == 0)
+ return stmt_dup(v);
+ return stmt_project(stmt_dup(o), stmt_dup(v));
+}
+
+static stmt *
reljoin( mvc *sql, stmt *rj, list *l2 )
{
node *n = l2->h;
@@ -778,11 +786,21 @@
stmt *rd = (j->type == st_join)?stmt_reverse(o2):o2;
if (j->type == st_joinN) {
- /* make single list will columns/values,
- call function
- Then same als lower
- */
- assert(0);
+ stmt *cmp;
+ list *ol,*nl = create_stmt_list();
+ node *m;
+
+ ol = j->op1.stval->op1.lval;
+ for (m = ol->h; m; m = m->next)
+ list_append(nl, _project(l, m->data));
+ ol = j->op2.stval->op1.lval;
+ for (m = ol->h; m; m = m->next)
+ list_append(nl, _project(r, m->data));
+ /* find function */
+ cmp = stmt_uselect( stmt_Nop( stmt_list(nl),
j->op4.funcval), stmt_bool(1), cmp_equal);
+ /* TODO semijoin may break order */
+ l = stmt_semijoin(stmt_dup(l), stmt_dup(cmp));
+ r = stmt_semijoin(stmt_dup(r), cmp);
} else if (j->type == st_join2) {
stmt *le = stmt_project(l, ld );
stmt *re = stmt_project(r, rd );
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list