Changeset: 2860a55aa2a4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2860a55aa2a4
Modified Files:
        
Branch: gdk-calc
Log Message:

Merge with default branch.


diffs (truncated from 550 to 300 lines):

diff --git a/gdk/gdk_bbp.mx b/gdk/gdk_bbp.mx
--- a/gdk/gdk_bbp.mx
+++ b/gdk/gdk_bbp.mx
@@ -2491,6 +2491,10 @@ BBPkeepref(bat i)
                i = -i;
        if (BBPcheck(i, "BBPkeepref")) {
                int lock = locked_by ? BBP_getpid() != locked_by : 1;
+               BAT *b;
+
+               if ((b = BBPdescriptor(i)) != NULL)
+                       BATsettrivprop(b);
 
                incref(i, TRUE, lock);
                assert(BBP_refs(i));
diff --git a/monetdb5/modules/kernel/algebra.mx 
b/monetdb5/modules/kernel/algebra.mx
--- a/monetdb5/modules/kernel/algebra.mx
+++ b/monetdb5/modules/kernel/algebra.mx
@@ -1081,8 +1081,8 @@ algebra_export str ALGselectNotNil(int *
 algebra_export str ALGuhashsplit(int *result, int *bid, int *nfrag);
 
 @= project_export
-algebra_export str ALGprojecthead_@1(int *ret,ptr *val, int *bid);
-algebra_export str ALGprojecttail_@1(int *ret,int *bid, ptr *val);
+algebra_export str ALGprojecthead_@1(int *ret, @1 *val, int *bid);
+algebra_export str ALGprojecttail_@1(int *ret, int *bid, @1 *val);
 @
 @h
 @:project_export(int)@
@@ -1526,12 +1526,6 @@ CMDfragment(BAT **result, BAT *b, ptr hl
 }
 
 static int
-CMDthetajoin(BAT **result, BAT *left, BAT *right, int *mode, lng *estimate)
-{
-       return (*result = BATthetajoin(left, right, *mode, *estimate == lng_nil 
|| *estimate < 0 ? BUN_NONE : (*estimate >= (lng) BUN_MAX ? BUN_MAX : (BUN) 
*estimate))) ? GDK_SUCCEED : GDK_FAIL;
-}
-
-static int
 CMDbandjoin(BAT **result, BAT *left, BAT *right, ptr minus, ptr plus, bit *li, 
bit *hi)
 {
        return (*result = BATbandjoin(left, right, minus, plus, *li, *hi)) ? 
GDK_SUCCEED : GDK_FAIL;
@@ -2606,8 +2600,8 @@ ALGthetajoinEstimate(int *result, int *l
                BBPreleaseref(left->batCacheid);
                BBPreleaseref(right->batCacheid);
                throw(MAL, "algebra.thetajoin", ILLEGAL_ARGUMENT " Theta 
comparison <> not yet supported");
-       } 
-       CMDthetajoin(&bn, left, right, opc, estimate);
+       }
+       bn = BATthetajoin(left, right, *opc, *estimate == lng_nil || *estimate 
< 0 ? BUN_NONE : (*estimate >= (lng) BUN_MAX ? BUN_MAX : (BUN) *estimate));
        if (bn) {
                if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
                *result = bn->batCacheid;
@@ -3692,51 +3686,37 @@ ALGprojectNIL(int *ret, int *bid)
  * The constant versions are typed by the parser
  */
 @= projectImpl
-str ALGprojecthead_@1(int *ret,ptr *val, int *bid){
+str
+ALGprojecthead_@1(int *ret, @1 *val, int *bid)
+{
        BAT *b, *bn;
-       BUN p,q;
-       BATiter bi;
 
        @:getBATdescriptor(bid,b,"batcalc.project")@
 
-       bn= BATnew(TYPE_@1,BATttype(b),BATcount(b));
+       b = BATmirror(b);
+       bn = BATconst(b, TYPE_@1, val);
+       bn = BATmirror(bn);
+
        @:tstBAT("algebra.project")@
-       bi = bat_iterator(b);
-       BATaccessBegin(b,USE_TAIL,MMAP_SEQUENTIAL);
-       BATloop(b, p, q) {
-               ptr v = BUNtail(bi,p);
-               bunfastins(bn, val,v);
-       }
-       bn->H->nonil = (ATOMcmp(bn->htype, val, ATOMnilptr(bn->htype))); 
-       bn->T->nonil = b->T->nonil;
-bunins_failed:
-       BATaccessEnd(b,USE_TAIL,MMAP_SEQUENTIAL);
-       if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ); \
+       if (!(bn->batDirty&2))
+               bn = BATsetaccess(bn, BAT_READ);
        *ret= bn->batCacheid;
        BBPkeepref(bn->batCacheid);
        BBPreleaseref(b->batCacheid);
        return MAL_SUCCEED;
 }
-str ALGprojecttail_@1(int *ret,int *bid, ptr *val){
+str
+ALGprojecttail_@1(int *ret, int *bid, @1 *val)
+{
        BAT *b, *bn;
-       BUN p,q;
-       BATiter bi;
 
        @:getBATdescriptor(bid,b,"batcalc.project")@
 
-       bn= BATnew(BAThtype(b),TYPE_@1,BATcount(b));
+       bn = BATconst(b, TYPE_@1, val);
+
        @:tstBAT("algebra.project")@
-       bi = bat_iterator(b);
-       BATaccessBegin(b,USE_HEAD,MMAP_SEQUENTIAL);
-       BATloop(b, p, q) {
-               ptr v = BUNhead(bi,p);
-               bunfastins(bn,v, val);
-       }
-       bn->H->nonil = b->H->nonil;
-       bn->T->nonil = (ATOMcmp(bn->ttype, val, ATOMnilptr(bn->ttype))); 
-bunins_failed:
-       BATaccessEnd(b,USE_HEAD,MMAP_SEQUENTIAL);
-       if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ); \
+       if (!(bn->batDirty&2))
+               bn = BATsetaccess(bn, BAT_READ);
        *ret= bn->batCacheid;
        BBPkeepref(bn->batCacheid);
        BBPreleaseref(b->batCacheid);
diff --git a/monetdb5/modules/kernel/kprelude.mx 
b/monetdb5/modules/kernel/kprelude.mx
--- a/monetdb5/modules/kernel/kprelude.mx
+++ b/monetdb5/modules/kernel/kprelude.mx
@@ -21,48 +21,48 @@ All Rights Reserved.
 The Mx macros below are used in many places throughout the code base.
 
 @= getBATdescriptor
-       if( (@2= BATdescriptor(*@1)) == NULL ){ @4;
-                throw(MAL, @3, RUNTIME_OBJECT_MISSING);
-   }
+       if ((@2 = BATdescriptor(*@1)) == NULL) {
+               @4;
+               throw(MAL, @3, RUNTIME_OBJECT_MISSING);
+       }
 @= tstBAT
-if( bn== NULL) {*ret= 0;
-    throw(MAL, @1, MAL_MALLOC_FAIL);}
+       if (bn == NULL) {
+               *ret = 0;
+               throw(MAL, @1, MAL_MALLOC_FAIL);
+       }
 
 @= resBAT
-    bn = BATnew(ATOMtype(b->htype), TYPE_@1, BATcount(b));
-    if ( bn== NULL) {
-               @3
+       bn = BATnew(ATOMtype(b->htype), TYPE_@1, BATcount(b));
+       if (bn == NULL) {
                throw(MAL, @2, MAL_MALLOC_FAIL);
-    }
-    bn->hsorted = b->hsorted;
-    bn->tsorted = b->tsorted;
-    bn->H->nonil = b->H->nonil;
-    bn->T->nonil = b->T->nonil;
-    BATkey(bn, BAThkey(b));
+       }
+       bn->hsorted = b->hsorted;
+       bn->tsorted = b->tsorted;
+       bn->H->nonil = b->H->nonil;
+       bn->T->nonil = b->T->nonil;
+       BATkey(bn, BAThkey(b));
 
 @= resultBAT
-    if (BAThvoid(b)) {
-        bn = BATnew(TYPE_void, TYPE_@1, BATcount(b));
-        BATseqbase(bn, b->hseqbase);
-    } else {
-        bn = BATnew(b->htype, TYPE_@1, BATcount(b));
-    }
-    if ( bn== NULL) {
-               @3
+       if (BAThvoid(b)) {
+               bn = BATnew(TYPE_void, TYPE_@1, BATcount(b));
+               BATseqbase(bn, b->hseqbase);
+       } else {
+               bn = BATnew(b->htype, TYPE_@1, BATcount(b));
+       }
+       if (bn == NULL) {
                throw(MAL, @2, MAL_MALLOC_FAIL);
-    }
-    bn->hsorted = b->hsorted;
-    bn->tsorted = b->tsorted;
-    if (!BAThvoid(b))
-       bn->H->nonil = b->H->nonil;
-    bn->T->nonil = b->T->nonil;
-    BATkey(bn, BAThkey(b));
+       }
+       bn->hsorted = b->hsorted;
+       bn->tsorted = b->tsorted;
+       if (!BAThvoid(b))
+               bn->H->nonil = b->H->nonil;
+       bn->T->nonil = b->T->nonil;
+       BATkey(bn, BAThkey(b));
 
 @= voidresultBAT
        bn = BATnew(TYPE_void, @1, BATcount(b));
        BATseqbase(bn, b->hseqbase);
        if (bn == NULL) {
-               @3
                throw(MAL, @2, MAL_MALLOC_FAIL);
        }
        bn->hsorted = b->hsorted;
@@ -73,10 +73,8 @@ if( bn== NULL) {*ret= 0;
 @= Pseudo
        if (BBPindex("view_@1_@2") <= 0)
                BATname(b, "@2");
-       BATroles(b,"@1","@2");
-       BATmode(b,TRANSIENT);
+       BATroles(b, "@1", "@2");
+       BATmode(b, TRANSIENT);
        BBPkeepref(b->batCacheid);
        BATfakeCommit(b);
        *ret = b->batCacheid;
-
-
diff --git a/monetdb5/tests/BugTracker/Tests/All 
b/monetdb5/tests/BugTracker/Tests/All
--- a/monetdb5/tests/BugTracker/Tests/All
+++ b/monetdb5/tests/BugTracker/Tests/All
@@ -9,3 +9,5 @@ parser.SF-2051309
 mal_var_persistent_over_sessions.SF-2581675
 merge-join_properties.SF-2952191
 joinpath-loop.Bug-2965
+thetajoin-properties.Bug-2974
+algebra_project.Bug-3045
diff --git a/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal 
b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.mal
@@ -0,0 +1,12 @@
+b := bat.new(:oid, :bte);
+b := bat.append(b, 100:bte);
+b := bat.append(b, 105:bte);
+b := bat.append(b, 100:bte);
+b := bat.append(b, 105:bte);
+b := bat.append(b, 115:bte);
+io.print(b);
+c := algebra.project(0@0,b);
+io.print(c);
+d := bat.reverse(b);
+e := algebra.project(d,0@0);
+io.print(e);
diff --git 
a/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.err 
b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.err
@@ -0,0 +1,31 @@
+stderr of test 'algebra_project.Bug-3045` in directory 'tests/BugTracker` 
itself:
+
+
+# 13:21:49 >  
+# 13:21:49 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/ufs/sjoerd/Monet-stable/var/MonetDB" "--set" "mapi_open=true" 
"--set" "mapi_port=39429" "--set" "monet_prompt=" "--trace" "--forcemito" 
"--set" "mal_listing=2" "--dbname=mTests_tests_BugTracker" 
"algebra_project.Bug-3045.mal"
+# 13:21:49 >  
+
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = /ufs/sjoerd/Monet-stable/var/monetdb5/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  gdk_dbfarm = /ufs/sjoerd/Monet-stable/var/MonetDB
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 39429
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_tests_BugTracker
+
+# 13:21:49 >  
+# 13:21:49 >  "Done."
+# 13:21:49 >  
+
diff --git 
a/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out 
b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/tests/BugTracker/Tests/algebra_project.Bug-3045.stable.out
@@ -0,0 +1,64 @@
+stdout of test 'algebra_project.Bug-3045` in directory 'tests/BugTracker` 
itself:
+
+
+# 13:21:49 >  
+# 13:21:49 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/ufs/sjoerd/Monet-stable/var/MonetDB" "--set" "mapi_open=true" 
"--set" "mapi_port=39429" "--set" "monet_prompt=" "--trace" "--forcemito" 
"--set" "mal_listing=2" "--dbname=mTests_tests_BugTracker" 
"algebra_project.Bug-3045.mal"
+# 13:21:49 >  
+
+# MonetDB 5 server v11.7.8 (hg id: 8594feb8b79b+)
+# This is an unreleased version
+# Serving database 'mTests_tests_BugTracker', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 15.629 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2012 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://madrid.ins.cwi.nl:39429/
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to