Changeset: 9125feb96027 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9125feb96027
Modified Files:
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/mal/Tests/mapi07.stable.out
        monetdb5/modules/mal/Tests/remote12.stable.out
        monetdb5/modules/mal/mal_mapi.c
        sql/backends/monet5/UDF/udf.c
Branch: default
Log Message:

merged


diffs (155 lines):

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
@@ -881,7 +881,7 @@ BKCisSortedReverse(bit *res, const bat *
 
 /*
  * We must take care of the special case of a nil column 
(TYPE_void,seqbase=nil)
- * such nil columns never set hkey (and BUNins will never invalidate it if 
set) yet
+ * such nil columns never set hkey 
  * a nil column of a BAT with <= 1 entries does not contain doubles => return 
TRUE.
  */
 
diff --git a/monetdb5/modules/mal/Tests/mapi07.stable.out 
b/monetdb5/modules/mal/Tests/mapi07.stable.out
--- a/monetdb5/modules/mal/Tests/mapi07.stable.out
+++ b/monetdb5/modules/mal/Tests/mapi07.stable.out
@@ -39,7 +39,7 @@ end user.main;
 # t    t  # name
 # void int  # type
 #--------------------------#
-[ 2@0, nil  ]
+[ 0@0, nil  ]
 
 # 09:12:08 >  
 # 09:12:08 >  Done.
diff --git a/monetdb5/modules/mal/Tests/remote12.stable.out 
b/monetdb5/modules/mal/Tests/remote12.stable.out
--- a/monetdb5/modules/mal/Tests/remote12.stable.out
+++ b/monetdb5/modules/mal/Tests/remote12.stable.out
@@ -16,25 +16,20 @@ stdout of test 'remote12` in directory '
 # Listening for connection requests on mapi:monetdb://eir.ins.cwi.nl:33456/
 # MonetDB/GIS module loaded
 # MonetDB/SQL module loaded
-!SyntaxException:parseError:e := nil:BAT;
-!SyntaxException:parseError:           ^<type identifier> expected
-!SyntaxException:parseError:m:str := remote.put(conn, e);
-!SyntaxException:parseError:^operator expected
-!SyntaxException:parseError:v:BAT := remote.get(conn,m);
-!SyntaxException:parseError:     ^<type identifier> expected
-!SyntaxException:parseError:io.print(v);
-!SyntaxException:parseError:^';' expected
 function user.main():void;
 #causing a sigfault  
     uri := sabaoth.getLocalConnectionURI();
     conn:str  := remote.connect(uri,"monetdb","monetdb");
     e := nil:BAT;
+    m:str := remote.put(conn,e);
     io.print(m);
-    v:BAT;
+    v:BAT := remote.get(conn,m);
+    io.print(v);
     mdb.var();
 end user.main;
 
 
+
 # 20:06:20 >  
 # 20:06:20 >  Done.
 # 20:06:20 >  
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -1581,54 +1581,31 @@ SERVERmapi_rpc_bat(Client cntxt, MalBlkP
        bat *ret;
        int *key;
        str *qry,err= MAL_SUCCEED;
-       int i;
        Mapi mid;
        MapiHdl hdl;
-       char *fld1, *fld2;
+       char *fld2;
        BAT *b;
-       ValRecord hval,tval;
-       int ht,tt;
+       ValRecord tval;
+       int i=0, tt;
 
        (void) cntxt;
        ret= getArgReference_bat(stk,pci,0);
        key= getArgReference_int(stk,pci,pci->retc);
        qry= getArgReference_str(stk,pci,pci->retc+1);
        accessTest(*key, "rpc");
-       ht= getHeadType(getVarType(mb,getArg(pci,0)));
        tt= getColumnType(getVarType(mb,getArg(pci,0)));
 
        hdl= mapi_query(mid, *qry);
        catchErrors("mapi.rpc");
 
-       assert(ht == TYPE_void || ht== TYPE_oid);
        b= BATnew(TYPE_void,tt,256, TRANSIENT);
        if ( b == NULL)
                throw(MAL,"mapi.rpc",MAL_MALLOC_FAIL);
        BATseqbase(b,0);
-       i= 0;
-       if ( mapi_fetch_row(hdl)){
-               int oht = ht, ott = tt;
-
-               fld1= mapi_fetch_field(hdl,0);
+       while( mapi_fetch_row(hdl)){
                fld2= mapi_fetch_field(hdl,1);
-               if (fld1 && ht == TYPE_void)
-                       ht = TYPE_oid;
-               if (fld2 && tt == TYPE_void)
-                       tt = TYPE_oid;
-               SERVERfieldAnalysis(fld1, ht, &hval);
                SERVERfieldAnalysis(fld2, tt, &tval);
-               if (oht != ht)
-                       BATseqbase(b, hval.val.oval);
-               if (ott != tt)
-                       BATseqbase(BATmirror(b), tval.val.oval);
-               BUNins(b,VALptr(&hval),VALptr(&tval), FALSE);
-       }
-       while( mapi_fetch_row(hdl)){
-               fld1= mapi_fetch_field(hdl,0);
-               fld2= mapi_fetch_field(hdl,1);
-               SERVERfieldAnalysis(fld1, ht, &hval);
-               SERVERfieldAnalysis(fld2, tt, &tval);
-               BUNins(b,VALptr(&hval),VALptr(&tval), FALSE);
+               BUNappend(b,VALptr(&tval), FALSE);
        }
        if (!(b->batDirty&2)) BATsetaccess(b, BAT_READ);
        *ret = b->batCacheid;
diff --git a/sql/backends/monet5/UDF/udf.c b/sql/backends/monet5/UDF/udf.c
--- a/sql/backends/monet5/UDF/udf.c
+++ b/sql/backends/monet5/UDF/udf.c
@@ -86,8 +86,8 @@ UDFBATreverse_(BAT **ret, BAT *src)
                      "tail-type of input BAT must be TYPE_str");
        }
 
-       /* allocate result BAT */
-       bn = BATnew(src->htype, TYPE_str, BATcount(src), TRANSIENT);
+       /* allocate void-headed result BAT */
+       bn = BATnew(TYPE_void, TYPE_str, BATcount(src), TRANSIENT);
        if (bn == NULL) {
                throw(MAL, "batudf.reverse", MAL_MALLOC_FAIL);
        }
@@ -100,8 +100,6 @@ UDFBATreverse_(BAT **ret, BAT *src)
        BATloop(src, p, q) {
                char *tr = NULL, *err = NULL;
 
-               /* get original head & tail value */
-               ptr h = BUNhead(li, p);
                const char *t = (const char *) BUNtail(li, p);
 
                /* revert tail value */
@@ -115,9 +113,8 @@ UDFBATreverse_(BAT **ret, BAT *src)
                /* assert logical sanity */
                assert(tr != NULL);
 
-               /* insert original head and reversed tail in result BAT */
-               /* BUNins() takes care of all necessary administration */
-               BUNins(bn, h, tr, FALSE);
+               /* append reversed tail in result BAT */
+               BUNappend(bn, tr, FALSE);
 
                /* free memory allocated in UDFreverse_() */
                GDKfree(tr);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to