commit 03da46637c35db36d4a94acf6182675441eadab8
Author: dprunier <dominique.prunier@watch4net.com>
Date:   Mon Mar 26 10:26:02 2012

     * in category::patternSearch, skip the decompression/compression phase
     * in category::patternSearch, use sloppyCount for estimation
     * in query::doEvaluate, fix returned value when term == null (was 0, now is row count)
     * in query::doEvaluate, even more usage of bitvector::sloppyCount instead of bitvector::cnt
     * in query::doEvaluate, removed complex OR evaluation depending on bitmap sizes

diff --git a/src/category.cpp b/src/category.cpp
index 5fcc729..b445197 100644
--- a/src/category.cpp
+++ b/src/category.cpp
@@ -726,19 +726,15 @@ long ibis::category::patternSearch(const char *pat,
 	const ibis::bitvector *bv = rlc->getBitvector(tmp[j]);
 	if (bv != 0) {
 	    ++ cnt;
-	    est += bv->cnt();
+	    est += bv->sloppyCount();
 	    if (hits.empty()) {
 		hits.copy(*bv);
 	    }
 	    else {
-		if (cnt > 32 || (j > 3 && cnt*16 > j))
-		    hits.decompress();
 		hits |= *bv;
 	    }
 	}
     }
-    if (est > static_cast<long>(hits.size() >> 7))
-	hits.compress();
     return est;
 } // ibis::category::patternSearch
 
diff --git a/src/query.cpp b/src/query.cpp
index e78e244..eb7191c 100755
--- a/src/query.cpp
+++ b/src/query.cpp
@@ -3546,7 +3546,7 @@ int ibis::query::doEvaluate(const ibis::qExpr* term,
 	ierr = doEvaluate(term->getLeft(), ht);
 	if (ierr >= 0) {
 	    ht.flip();
-	    ierr = ht.cnt();
+	    ierr = ht.sloppyCount();
 	}
 	break;
     }
@@ -3755,26 +3755,26 @@ int ibis::query::doEvaluate(const ibis::qExpr* term,
 int ibis::query::doEvaluate(const ibis::qExpr* term,
 			    const ibis::bitvector& mask,
 			    ibis::bitvector& ht) const {
-    int ierr = 0;
     if (term == 0) { // all hits
-	ht.set(1, mypart->nRows());
-	return ierr;
+	ht.copy(mask);
+	return mypart->nRows();
     }
     if (mask.cnt() == 0) { // no hits
 	ht.set(0, mask.size());
-	return ierr;
+	return 0;
     }
     LOGGER(ibis::gVerbose > 7)
 	<< "query[" << myID << "]::doEvaluate -- starting to evaluate "
 	<< *term;
 
+    int ierr = 0;
     switch (term->getType()) {
     case ibis::qExpr::LOGICAL_NOT: {
 	ierr = doEvaluate(term->getLeft(), mask, ht);
 	if (ierr >= 0) {
 	    ht.flip();
 	    ht &= mask;
-	    ierr = ht.cnt();
+	    ierr = ht.sloppyCount();
 	}
 	break;
     }
@@ -3792,13 +3792,7 @@ int ibis::query::doEvaluate(const ibis::qExpr* term,
 	ierr = doEvaluate(term->getLeft(), mask, ht);
 	if (ierr >= 0) {
 	    ibis::bitvector b1;
-	    if (ht.cnt() > mask.bytes() + ht.bytes()) {
-		std::auto_ptr<ibis::bitvector> newmask(mask - ht);
-		ierr = doEvaluate(term->getRight(), *newmask, b1);
-	    }
-	    else {
-		ierr = doEvaluate(term->getRight(), mask, b1);
-	    }
+	    ierr = doEvaluate(term->getRight(), mask, b1);
 	    if (ierr > 0)
 		ht |= b1;
 	    ierr = ht.sloppyCount();
@@ -3972,7 +3966,7 @@ int ibis::query::doEvaluate(const ibis::qExpr* term,
 	if (cr.isConstant()) {
 	    if (cr.inRange()) {
 		ht.copy(mask);
-		ierr = mask.cnt();
+		ierr = ht.sloppyCount();
 	    }
 	    else {
 		ht.set(0, mask.size());
@@ -3990,7 +3984,7 @@ int ibis::query::doEvaluate(const ibis::qExpr* term,
 	if (mt.isConstant()) {
 	    if (mt.isTrue()) {
 		ht.copy(mask);
-		ierr = mask.cnt();
+		ierr = mask.sloppyCount();
 	    }
 	    else {
 		ht.set(0, mask.size());
@@ -4023,7 +4017,7 @@ int ibis::query::doEvaluate(const ibis::qExpr* term,
     case ibis::qExpr::TOPK:
     case ibis::qExpr::DEPRECATEDJOIN: { // pretend every row qualifies
 	ht.copy(mask);
-	ierr = ht.cnt();
+	ierr = ht.sloppyCount();
 	break;
     }
     default:
