Changeset: 84eca90b3ed1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=84eca90b3ed1
Modified Files:
sql/backends/monet5/sql.mx
Branch: default
Log Message:
we want leftfetchjoin's instead of leftjoins as much as possible.
diffs (58 lines):
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -3537,7 +3537,7 @@ DELTAsub(bat *result, bat *col, bat *uid
str
DELTAproject(bat *result, bat *sub, bat *col, bat *uid, bat *uval, bat *ins)
{
- BAT *s, *c, *u_id, *u_val, *u, *i, *res;
+ BAT *s, *c, *u_id, *u_val, *u, *i, *res, *tres;
if ((s = BATdescriptor(*sub)) == NULL)
throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
@@ -3563,27 +3563,35 @@ DELTAproject(bat *result, bat *sub, bat
}
/* leftfetchjoin(sub,col).union(leftfetchjoin(sub,i)) */
- res = BATleftjoin(s, c, BATcount(c));
- BBPunfix(c->batCacheid);
-
+ res = c;
if (BATcount(i)) {
- BAT *tres = BATleftjoin(s, i, BATcount(i));
-
- if (res) {
- res = setwritable(res);
- res = BATappend(res,tres,FALSE);
- BBPunfix(tres->batCacheid);
+ if (BATcount(c) == 0) {
+ res = i;
+ i = c;
} else {
- res = tres;
+ if ((res = BATcopy(c, TYPE_void, c->ttype, TRUE)) ==
NULL)
+ throw(MAL, "sql.projectdelta",
OPERATION_FAILED);
+ res = BATappend(res,i,FALSE);
+ BBPunfix(c->batCacheid);
}
}
BBPunfix(i->batCacheid);
+ tres = BATleftfetchjoin(s, res, BATcount(res));
+ BBPunfix(res->batCacheid);
+ res = tres;
+
if ((u_id = BATdescriptor(*uid)) == NULL) {
BBPunfix(res->batCacheid);
BBPunfix(s->batCacheid);
throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
}
+ if (!BATcount(u_id)) {
+ BBPunfix(u_id->batCacheid);
+ BBPunfix(s->batCacheid);
+ BBPkeepref(*result = res->batCacheid);
+ return MAL_SUCCEED;
+ }
if ((u_val = BATdescriptor(*uval)) == NULL) {
BBPunfix(u_id->batCacheid);
BBPunfix(res->batCacheid);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list