Changeset: fb06eb104dda for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb06eb104dda Modified Files: MonetDB.spec debian/monetdb-client-testing.install gdk/gdk_select.c Branch: Feb2013 Log Message:
Merge with Oct2012 branch. diffs (149 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -334,7 +334,6 @@ developer. %{_bindir}/malsample.pl %{_bindir}/sqlsample.php %{_bindir}/sqlsample.pl -%{_bindir}/sqlsample.py %if %{?centos:0}%{!?centos:1} %package geom-MonetDB5 diff --git a/debian/monetdb-client-testing.install b/debian/monetdb-client-testing.install --- a/debian/monetdb-client-testing.install +++ b/debian/monetdb-client-testing.install @@ -11,4 +11,3 @@ debian/tmp/usr/bin/testgetinfo usr/bin debian/tmp/usr/bin/malsample.pl usr/bin debian/tmp/usr/bin/sqlsample.php usr/bin debian/tmp/usr/bin/sqlsample.pl usr/bin -debian/tmp/usr/bin/sqlsample.py usr/bin diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -537,6 +537,44 @@ BAT_scanselect(BAT *b, BAT *s, BAT *bn, * - if tl==nil and th!=NULL, no lower bound; * - if th==NULL or tl==th, point (equi) select; * - if th==nil, no upper bound + * + * A complete breakdown of the various arguments follows. Here, v, v1 + * and v2 are values from the appropriate domain, and + * v != nil, v1 != nil, v2 != nil, v1 < v2. + * tl th li hi anti result list of OIDs for values + * ----------------------------------------------------------------- + * nil NULL ignored ignored false x = nil (only way to get nil) + * nil NULL ignored ignored true x != nil + * nil nil ignored ignored false x != nil + * nil v ignored false false x < v + * nil v ignored true false x <= v + * nil v ignored false true x >= v + * nil v ignored true true x > v + * v nil false ignored false x > v + * v nil true ignored false x >= v + * v nil false ignored true x <= v + * v nil true ignored true x < v + * v NULL false ignored false NOTHING + * v NULL true ignored false x == v + * v NULL false ignored true x != nil + * v NULL true ignored true x != v + * v v false false false NOTHING + * v v true false false NOTHING + * v v false true false NOTHING + * v v true true false x == v + * v v false false true x != nil + * v v true false true x != nil + * v v false true true x != nil + * v v true true true x != v + * v1 v2 false false false v1 < x < v2 + * v1 v2 true false false v1 <= x < v2 + * v1 v2 false 1 false v1 < x <= v2 + * v1 v2 true true false v1 <= x <= v2 + * v1 v2 false false true x <= v1 or x >= v2 + * v1 v2 true false true x < v1 or x >= v2 + * v1 v2 false true true x <= v1 or x > v2 + * v1 v2 true true true x < v1 or x > v2 + * v2 v1 ignored ignored ignored NOTHING */ BAT * BATsubselect(BAT *b, BAT *s, const void *tl, const void *th, @@ -640,11 +678,24 @@ BATsubselect(BAT *b, BAT *s, const void lval = 0; hval = 0; ALGODEBUG fprintf(stderr, "#BATsubselect(b=%s#" BUNFMT - ",s=%s,anti=%d): anti-nil\n", + ",s=%s,anti=0): anti-nil\n", BATgetId(b), BATcount(b), - s ? BATgetId(s) : "NULL", anti); - } else { + s ? BATgetId(s) : "NULL"); + } else if (equi) { equi = 0; + if (!(li && hi)) { + /* antiselect for nothing: turn into + * range select for nil-nil range + * (i.e. everything but nil) */ + anti = 0; + lval = 0; + hval = 0; + ALGODEBUG fprintf(stderr, "#BATsubselect(b=%s#" + BUNFMT ",s=%s,anti=0): " + "anti-nothing\n", + BATgetId(b), BATcount(b), + s ? BATgetId(s) : "NULL"); + } } } @@ -812,36 +863,36 @@ BATsubselect(BAT *b, BAT *s, const void assert(s->tsorted); assert(s->tkey); if (BATtdense(s)) { - maximum = MIN( maximum , - MIN( oh , s->tseqbase + BATcount(s)) - - MAX( ol , s->tseqbase ) ); + maximum = MIN(maximum , + MIN(oh, s->tseqbase + BATcount(s)) + - MAX(ol, s->tseqbase)); } else { - maximum = MIN( maximum , - SORTfndfirst(s, &oh) - - SORTfndfirst(s, &ol) ) ; + maximum = MIN(maximum, + SORTfndfirst(s, &oh) + - SORTfndfirst(s, &ol)); } } if (b->tkey) { /* exact result size in special cases */ if (equi) { estimate = 1; - } else - if (!anti && lval && hval) { - if (ATOMstorage(b->ttype) == TYPE_bte) { + } else if (!anti && lval && hval) { + switch (ATOMstorage(b->ttype)) { + case TYPE_bte: estimate = (BUN) (*(bte*) th - *(bte*) tl); - } else - if (ATOMstorage(b->ttype) == TYPE_sht) { + break; + case TYPE_sht: estimate = (BUN) (*(sht*) th - *(sht*) tl); - } else - if (ATOMstorage(b->ttype) == TYPE_int) { + break; + case TYPE_int: estimate = (BUN) (*(int*) th - *(int*) tl); - } else - if (ATOMstorage(b->ttype) == TYPE_lng) { + break; + case TYPE_lng: estimate = (BUN) (*(lng*) th - *(lng*) tl); + break; } - if (estimate != BUN_NONE) { + if (estimate != BUN_NONE) estimate += li + hi - 1; - } } } /* refine upper limit by exact size (if known) */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list