Update of /cvsroot/monetdb/MonetDB4/src/modules/plain
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8792

Modified Files:
      Tag: MonetDB_4-22
        bat_arith.mx 
Log Message:
fixed bug in sort propagation

r := [*](b,v) did r->tsorted = BATtordered(b)
        which is not correct if v < 0


Index: bat_arith.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB4/src/modules/plain/bat_arith.mx,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -d -r1.4.2.1 -r1.4.2.2
--- bat_arith.mx        5 Feb 2008 22:33:30 -0000       1.4.2.1
+++ bat_arith.mx        8 Feb 2008 15:02:14 -0000       1.4.2.2
@@ -58,37 +58,37 @@
 
 @= operations
 @:@1_operation(bte,+,add,,0,2)@
-@:@1_operation(bte,-,sub,,0,1)@
-@:@1_operation(bte,*,mul,1,0,2)@
+@:@1_operation(bte,-,sub,,0,2)@
+@:@1_operation(bte,*,mul,1,0,3)@
 @:@1_operation(bte,/,div,1,1,1)@
 @:@1_operation(bte,%,mod,1,1,0)@
 @:@1_operation(sht,+,add,,0,2)@
-@:@1_operation(sht,-,sub,,0,1)@
-@:@1_operation(sht,*,mul,1,0,2)@
+@:@1_operation(sht,-,sub,,0,2)@
+@:@1_operation(sht,*,mul,1,0,3)@
 @:@1_operation(sht,/,div,1,1,1)@
 @:@1_operation(sht,%,mod,1,1,0)@
 @:@1_operation(int,+,add,,0,2)@
-@:@1_operation(int,-,sub,,0,1)@
-@:@1_operation(int,*,mul,1,0,2)@
+@:@1_operation(int,-,sub,,0,2)@
+@:@1_operation(int,*,mul,1,0,3)@
 @:@1_operation(int,/,div,1,1,1)@
 @:@1_operation(int,%,mod,1,1,0)@
 @:@1_operation(wrd,+,add,,0,2)@
-@:@1_operation(wrd,-,sub,,0,1)@
-@:@1_operation(wrd,*,mul,1,0,2)@
+@:@1_operation(wrd,-,sub,,0,2)@
+@:@1_operation(wrd,*,mul,1,0,3)@
 @:@1_operation(wrd,/,div,1,1,1)@
 @:@1_operation(wrd,%,mod,1,1,0)@
 @:@1_operation(lng,+,add,,0,2)@
-@:@1_operation(lng,-,sub,,0,1)@
-@:@1_operation(lng,*,mul,1,0,2)@
+@:@1_operation(lng,-,sub,,0,2)@
+@:@1_operation(lng,*,mul,1,0,3)@
 @:@1_operation(lng,/,div,1,1,1)@
 @:@1_operation(lng,%,mod,1,1,0)@
 @:@1_operation(flt,+,add,,0,2)@
-@:@1_operation(flt,-,sub,,0,1)@
-@:@1_operation(flt,*,mul,1,0,2)@
+@:@1_operation(flt,-,sub,,0,2)@
+@:@1_operation(flt,*,mul,1,0,3)@
 @:@1_operation(flt,/,div,1,1,1)@
 @:@1_operation(dbl,+,add,,0,2)@
-@:@1_operation(dbl,-,sub,,0,1)@
-@:@1_operation(dbl,*,mul,1,0,2)@
+@:@1_operation(dbl,-,sub,,0,2)@
+@:@1_operation(dbl,*,mul,1,0,3)@
 @:@1_operation(dbl,/,div,1,1,1)@
 @:@1_redefine_OP()@
 @:@1_operation(flt,%,mod,1,1,1,%)@
@@ -227,6 +227,12 @@
 
        if (@6 == 2) 
                bn->tsorted = BATtordered(b);
+       if (@6 == 3) { 
+               if (*v > 0)
+                       bn->tsorted = BATtordered(b);
+               else
+                       bn->tsorted = REVERT_SORTED(BATtordered(b));
+       }
 
        *ret = bn;
        return GDK_SUCCEED;
@@ -240,7 +246,6 @@
                   "[EMAIL PROTECTED]@3_inplace: BAT b must be void-headed.\n");
        /* todo for commutative operators call batval (ie. for * and /) */
 
-       b->tsorted = 0;
        bq = (@1*)Tloc(b,BUNlast(b));
        bp = (@1*)Tloc(b,BUNfirst(b));
        if (vv != @1_nil) {
@@ -261,6 +266,13 @@
 
        if (@6 == 2) 
                b->tsorted = BATtordered(b);
+       if (@6 == 3) { 
+               if (*v > 0)
+                       b->tsorted = BATtordered(b);
+               else
+                       b->tsorted = REVERT_SORTED(BATtordered(b));
+       } else 
+               b->tsorted = 0;
 
        BBPfix(b->batCacheid);
        *ret = b;
@@ -305,8 +317,14 @@
        }
        BATsetcount(bn, bnp-s);
        if (!bn->batDirty) bn->batDirty = TRUE;
-       if (@6) 
+       if (@6 == 2) 
                bn->tsorted = BATtordered(b);
+       if (@6 == 3) { 
+               if (*v > 0)
+                       bn->tsorted = BATtordered(b);
+               else
+                       bn->tsorted = REVERT_SORTED(BATtordered(b));
+       } 
 
        *ret = bn;
        return GDK_SUCCEED;
@@ -321,7 +339,6 @@
        ERRORcheck((b->htype!=TYPE_void),
                   "[EMAIL PROTECTED]@3_inplace: BAT b must be void-headed.\n");
 
-       b->tsorted = 0;
        bq = (@1*)Tloc(b,BUNlast(b));
        bp = (@1*)Tloc(b,BUNfirst(b));
        if (@5 && (vv == 0)) {
@@ -339,8 +356,15 @@
                }
        }
        if (!b->batDirty) b->batDirty = TRUE;
-       if (@6) 
+       if (@6 == 2) 
                b->tsorted = BATtordered(b);
+       if (@6 == 3) { 
+               if (*v > 0)
+                       b->tsorted = BATtordered(b);
+               else
+                       b->tsorted = REVERT_SORTED(BATtordered(b));
+       } else
+               b->tsorted = 0;
 
        BBPfix(b->batCacheid);
        *ret = b;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to