Changeset: 9fc148e2ba56 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9fc148e2ba56
Modified Files:
        monetdb5/modules/kernel/algebra.c
        sql/backends/monet5/sql_subquery.c
Branch: Jul2021
Log Message:

More quick descriptors


diffs (116 lines):

diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -786,29 +786,19 @@ ALGcrossproduct(bat *l, bat *r, const ba
        BAT *sl = NULL, *sr = NULL;
        gdk_return ret;
 
-       if ((L = BATdescriptor(*left)) == NULL) {
+       if ((L = BBPquickdesc(*left, false)) == NULL)
                throw(MAL, "algebra.crossproduct", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
-       }
-       if ((R = BATdescriptor(*right)) == NULL) {
-               BBPunfix(L->batCacheid);
+       if ((R = BBPquickdesc(*right, false)) == NULL)
                throw(MAL, "algebra.crossproduct", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
-       }
-       if (slid && !is_bat_nil(*slid) && (sl = BATdescriptor(*slid)) == NULL) {
-               BBPunfix(L->batCacheid);
-               BBPunfix(R->batCacheid);
+       if (slid && !is_bat_nil(*slid) && (sl = BATdescriptor(*slid)) == NULL)
                throw(MAL, "algebra.crossproduct", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
-       }
        if (srid && !is_bat_nil(*srid) && (sr = BATdescriptor(*srid)) == NULL) {
-               BBPunfix(L->batCacheid);
-               BBPunfix(R->batCacheid);
                if (sl)
                        BBPunfix(sl->batCacheid);
                throw(MAL, "algebra.crossproduct", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
        ret = BATsubcross(&bn1, r ? &bn2 : NULL, L, R, sl, sr,
                                          max_one && !is_bit_nil(*max_one) && 
*max_one);
-       BBPunfix(L->batCacheid);
-       BBPunfix(R->batCacheid);
        if (sl)
                BBPunfix(sl->batCacheid);
        if (sr)
@@ -1248,16 +1238,14 @@ ALGprojecttail(Client cntxt, MalBlkPtr m
        (void) mb;
        if( isaBatType(getArgType(mb,pci,2)) )
                throw(MAL,"algebra.project","Scalar value expected");
-       if ((b = BATdescriptor(bid)) == NULL)
+       if ((b = BBPquickdesc(bid, false)) == NULL)
                throw(MAL, "algebra.project", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        bn = BATconstant(b->hseqbase, v->vtype, VALptr(v), BATcount(b), 
TRANSIENT);
-       BBPunfix(b->batCacheid);
        if (bn == NULL) {
                *ret = bat_nil;
                throw(MAL, "algebra.project", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        }
-       *ret= bn->batCacheid;
-       BBPkeepref(bn->batCacheid);
+       BBPkeepref(*ret= bn->batCacheid);
        return MAL_SUCCEED;
 }
 
diff --git a/sql/backends/monet5/sql_subquery.c 
b/sql/backends/monet5/sql_subquery.c
--- a/sql/backends/monet5/sql_subquery.c
+++ b/sql/backends/monet5/sql_subquery.c
@@ -1142,25 +1142,20 @@ SQLexist(Client cntxt, MalBlkPtr mb, Mal
        (void)cntxt;
        if (isaBatType(getArgType(mb, pci, 1))) {
                bat *bid = getArgReference_bat(stk, pci, 1);
-               if (!(b = BATdescriptor(*bid)))
-                       throw(SQL, "aggr.exist", SQLSTATE(HY005) "Cannot access 
column descriptor");
+               if (!(b = BBPquickdesc(*bid, false)))
+                       throw(SQL, "aggr.exist", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                count = BATcount(b) != 0;
        }
        if (isaBatType(getArgType(mb, pci, 0))) {
                bat *res = getArgReference_bat(stk, pci, 0);
-               if ((r = BATconstant(b ? b->hseqbase : 0, TYPE_bit, &count, b ? 
BATcount(b) : 1, TRANSIENT)) == NULL) {
-                       if (b)
-                               BBPunfix(b->batCacheid);
+               if (!(r = BATconstant(b ? b->hseqbase : 0, TYPE_bit, &count, b 
? BATcount(b) : 1, TRANSIENT)))
                        throw(SQL, "aggr.exist", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-               }
                BBPkeepref(*res = r->batCacheid);
        } else {
                bit *res = getArgReference_bit(stk, pci, 0);
                *res = count;
        }
 
-       if (b)
-               BBPunfix(b->batCacheid);
        return MAL_SUCCEED;
 }
 
@@ -1218,25 +1213,20 @@ SQLnot_exist(Client cntxt, MalBlkPtr mb,
        (void)cntxt;
        if (isaBatType(getArgType(mb, pci, 1))) {
                bat *bid = getArgReference_bat(stk, pci, 1);
-               if (!(b = BATdescriptor(*bid)))
-                       throw(SQL, "aggr.not_exist", SQLSTATE(HY005) "Cannot 
access column descriptor");
+               if (!(b = BBPquickdesc(*bid, false)))
+                       throw(SQL, "aggr.not_exist", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                count = BATcount(b) == 0;
        }
        if (isaBatType(getArgType(mb, pci, 0))) {
                bat *res = getArgReference_bat(stk, pci, 0);
-               if ((r = BATconstant(b ? b->hseqbase : 0, TYPE_bit, &count, b ? 
BATcount(b) : 1, TRANSIENT)) == NULL) {
-                       if (b)
-                               BBPunfix(b->batCacheid);
+               if (!(r = BATconstant(b ? b->hseqbase : 0, TYPE_bit, &count, b 
? BATcount(b) : 1, TRANSIENT)))
                        throw(SQL, "aggr.not_exist", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-               }
                BBPkeepref(*res = r->batCacheid);
        } else {
                bit *res = getArgReference_bit(stk, pci, 0);
                *res = count;
        }
 
-       if (b)
-               BBPunfix(b->batCacheid);
        return MAL_SUCCEED;
 }
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to