Changeset: 2d4224b97efd for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2d4224b97efd
Modified Files:
        monetdb5/modules/mal/mat.mx
Branch: default
Log Message:

Ignore NIL BAT arguments in mat.pack
The subqueries in centipede may decide not to handle a subquery
due to non-relevant partition request. It will return a NIL rather
then an empty BAT, because it may later be wrongly interpreted
in aggregate queries.


diffs (56 lines):

diff --git a/monetdb5/modules/mal/mat.mx b/monetdb5/modules/mal/mat.mx
--- a/monetdb5/modules/mal/mat.mx
+++ b/monetdb5/modules/mal/mat.mx
@@ -199,6 +199,8 @@
 may create a really large BAT.
 The slice over a mat helps to avoid constructing intermediates
 that are subsequently reduced.
+Contrary to most operations, NIL arguments are skipped and
+do not produce RUNTIME_OBJECT_MISSING.
 @c
 static str
 MATpackInternal(MalStkPtr stk, InstrPtr p)
@@ -213,15 +215,18 @@
                b = BBPquickdesc(ABS(bid),FALSE);
                if (b && bid < 0)
                        b = BATmirror(b);
-               if( b == NULL)
-                       throw(MAL, "mat.pack", RUNTIME_OBJECT_MISSING);
-               if (ht == TYPE_any){
-                       ht = b->htype;
-                       tt = b->ttype;
+               if( b ){
+                       if (ht == TYPE_any){
+                               ht = b->htype;
+                               tt = b->ttype;
+                       }
+                       cap += BATcount(b);
                }
-               cap += BATcount(b);
        }
-       assert(ht != TYPE_any);
+       if (ht == TYPE_any){
+               *ret = 0;
+               return MAL_SUCCEED;
+       }
 
        bn = BATnew(ht, tt, cap);
        if (bn == NULL)
@@ -234,13 +239,11 @@
 
        for (i = 1; i < p->argc; i++) {
                b = BATdescriptor(stk->stk[getArg(p,i)].val.ival);
-               if( b == NULL){
-                       BBPreleaseref(bn->batCacheid);
-                       throw(MAL, "mat.pack", RUNTIME_OBJECT_MISSING);
+               if( b ){
+                       /* use the right oid ranges, don't change the input */
+                       BATins(bn,b,FALSE);
+                       BBPunfix(b->batCacheid);
                }
-               /* use the right oid ranges, don't change the input */
-               BATins(bn,b,FALSE);
-               BBPunfix(b->batCacheid);
        }
        BBPkeepref(*ret = bn->batCacheid);
        return MAL_SUCCEED;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to