Changeset: f71836a07703 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f71836a07703
Modified Files:
        
Branch: default
Log Message:

Merge with Apr2011 branch.


diffs (61 lines):

diff --git a/gdk/gdk_batop.mx b/gdk/gdk_batop.mx
--- a/gdk/gdk_batop.mx
+++ b/gdk/gdk_batop.mx
@@ -1045,6 +1045,10 @@
 Examine type, and values for lower- and higher-bound.
 @c
        batcnt = BATcount(b);
+       /* preliminarily determine result types */
+       ht = BAThtype(b);
+       tt = tail ? BATttype(b) : TYPE_void;
+
        t = b->ttype;
        nil = ATOMnilptr(t);
        lnil = ATOMcmp(t, tl, nil) == 0;
@@ -1056,11 +1060,12 @@
                th = tl;
                hval = 1;       /* equi-select */
        } else {
-               hval = ATOMcmp(t, th, nil);
+               hval = ATOMcmp(t, th, nil) != 0;
        }
        if (nequi) {
-               equi = 0;
-               if (!lval || !hval) {   /* swap sub-ranges */
+               if (!lval != !hval) {
+                       /* one of the end points is nil and the other
+                        * isn't: swap sub-ranges */
                        ptr tv;
                        bit ti;
                        ti = li;
@@ -1070,13 +1075,25 @@
                        tl = th;
                        th = tv;
                        nequi = 0;
-               }
+                       equi = 0;
+               } else if (!lval && !hval) {
+                       /* antiselect for nil-nil range: all non-nil
+                        * values are in range, so we need to return
+                        * all but, but we also don't want to return
+                        * nils, so instead we return nothing. */
+                       return BATnew(ht, tt, 10);
+               } else if (equi && lnil) {
+                       /* antiselect for nil value: turn into range
+                        * select for nil-nil range (i.e. everything
+                        * but nil) */
+                       equi = 0;
+                       nequi = 0;
+                       lval = 0;
+                       hval = 0;
+               } else
+                       equi = 0;
        }
 
-       /* preliminarily determine result types */
-       ht = BAThtype(b);
-       tt = tail ? BATttype(b) : TYPE_void;
-
        if (hval && ((ATOMcmp(t, tl, th) > 0) || (equi && !(li && hi)))) {
                /* empty range */
                ALGODEBUG THRprintf(GDKout, "#BAT_select_(b=%s): empty 
range;\n", BATgetId(b));
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to