Changeset: 564fd0b7b287 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=564fd0b7b287
Modified Files:
gdk/gdk_select.c
monetdb5/modules/kernel/bat5.c
sql/backends/monet5/sql.c
Branch: Oct2014
Log Message:
Get rid of some calls to legacy functions.
diffs (147 lines):
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -209,12 +209,11 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn,
}
BATsetcount(bn, cnt);
bn->tkey = 1;
- bn->tdense = bn->tsorted = bn->trevsorted = bn->batCount <= 1;
+ GDKqsort(dst, NULL, NULL, BATcount(bn), SIZEOF_OID, 0, TYPE_oid);
+ bn->tsorted = 1;
+ bn->tdense = bn->trevsorted = bn->batCount <= 1;
if (bn->batCount == 1)
bn->tseqbase = *dst;
- /* temporarily set head to nil so that BATorder doesn't materialize */
- BATseqbase(bn, oid_nil);
- bn = BATmirror(BATorder(BATmirror(bn)));
BATseqbase(bn, 0);
return bn;
}
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -1919,6 +1919,7 @@ BKCshrinkBAT(bat *ret, const bat *bid, c
BAT *b, *d, *bn, *bs;
BUN cnt =0;
oid oidx = 0, *o, *ol;
+ gdk_return res;
if ((b = BATdescriptor(*bid)) == NULL) {
throw(MAL, "bat.shrink", RUNTIME_OBJECT_MISSING);
@@ -1937,9 +1938,9 @@ BKCshrinkBAT(bat *ret, const bat *bid, c
BBPunfix(d->batCacheid);
throw(MAL, "bat.shrink", MAL_MALLOC_FAIL );
}
- bs = BATmirror(BATsort(BATmirror(d)));
+ res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0);
BBPunfix(d->batCacheid);
- if (bs == NULL) {
+ if (res == GDK_FAIL) {
BBPunfix(b->batCacheid);
BBPunfix(bn->batCacheid);
throw(MAL, "bat.shrink", MAL_MALLOC_FAIL );
@@ -2006,6 +2007,7 @@ BKCshrinkBATmap(bat *ret, const bat *bid
BAT *b, *d, *bn, *bs;
oid lim,oidx = 0, *o, *ol;
oid *r;
+ gdk_return res;
if ((b = BATdescriptor(*bid)) == NULL) {
throw(MAL, "bat.shrinkMap", RUNTIME_OBJECT_MISSING);
@@ -2029,9 +2031,9 @@ BKCshrinkBATmap(bat *ret, const bat *bid
BBPunfix(d->batCacheid);
throw(MAL, "bat.shrinkMap", MAL_MALLOC_FAIL );
}
- bs = BATmirror(BATsort(BATmirror(d)));
+ res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0);
BBPunfix(d->batCacheid);
- if (bs == NULL) {
+ if (res == GDK_FAIL) {
BBPunfix(b->batCacheid);
BBPunfix(bn->batCacheid);
throw(MAL, "bat.shrinkMap", MAL_MALLOC_FAIL );
@@ -2092,6 +2094,7 @@ BKCreuseBAT(bat *ret, const bat *bid, co
{
BAT *b, *d, *bn, *bs;
oid oidx = 0, bidx, *o, *ol;
+ gdk_return res;
if ((b = BATdescriptor(*bid)) == NULL) {
throw(MAL, "bat.reuse", RUNTIME_OBJECT_MISSING);
@@ -2110,9 +2113,9 @@ BKCreuseBAT(bat *ret, const bat *bid, co
BBPunfix(d->batCacheid);
throw(MAL, "bat.reuse", MAL_MALLOC_FAIL );
}
- bs = BATmirror(BATsort(BATmirror(d)));
+ res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0);
BBPunfix(d->batCacheid);
- if (bs == NULL) {
+ if (res == GDK_FAIL) {
BBPunfix(b->batCacheid);
BBPunfix(bn->batCacheid);
throw(MAL, "bat.reuse", MAL_MALLOC_FAIL );
@@ -2185,6 +2188,7 @@ BKCreuseBATmap(bat *ret, const bat *bid,
BAT *b, *d, *bn, *bs;
oid bidx, oidx = 0, *o, *ol;
oid *r;
+ gdk_return res;
if ((b = BATdescriptor(*bid)) == NULL) {
throw(MAL, "bat.shrinkMap", RUNTIME_OBJECT_MISSING);
@@ -2203,9 +2207,9 @@ BKCreuseBATmap(bat *ret, const bat *bid,
BBPunfix(d->batCacheid);
throw(MAL, "bat.shrinkMap", MAL_MALLOC_FAIL );
}
- bs = BATmirror(BATsort(BATmirror(d)));
+ res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0);
BBPunfix(d->batCacheid);
- if (bs == NULL) {
+ if (res == GDK_FAIL) {
BBPunfix(b->batCacheid);
BBPunfix(bn->batCacheid);
throw(MAL, "bat.shrinkMap", MAL_MALLOC_FAIL );
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2070,6 +2070,7 @@ str
DELTAsub(bat *result, const bat *col, const bat *cid, const bat *uid, const
bat *uval, const bat *ins)
{
BAT *c, *cminu, *u_id, *u_val, *u, *i = NULL, *res;
+ gdk_return ret;
if ((u_id = BBPquickdesc(abs(*uid), 0)) == NULL)
throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
@@ -2138,14 +2139,13 @@ DELTAsub(bat *result, const bat *col, co
res = BATappend(c, u, TRUE);
BBPunfix(u->batCacheid);
- u = BATsort(BATmirror(res));
+ ret = BATsubsort(&u, NULL, NULL, res, NULL, NULL, 0, 0);
BBPunfix(res->batCacheid);
- if (!u) {
+ if (ret == GDK_FAIL) {
BBPunfix(c->batCacheid);
throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
}
- res = BATmirror(BATmark(u, 0));
- BBPunfix(u->batCacheid);
+ res = u;
}
if (i) {
@@ -2174,12 +2174,11 @@ DELTAsub(bat *result, const bat *col, co
res = BATappend(res, i, TRUE);
BBPunfix(i->batCacheid);
- u = BATsort(BATmirror(res));
+ ret = BATsubsort(&u, NULL, NULL, res, NULL, NULL, 0, 0);
BBPunfix(res->batCacheid);
- if (!u)
+ if (ret == GDK_FAIL)
throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
- res = BATmirror(BATmark(u, 0));
- BBPunfix(u->batCacheid);
+ res = u;
}
BATkey(BATmirror(res), TRUE);
BBPkeepref(*result = res->batCacheid);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list