Changeset: dd497dca0dce for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dd497dca0dce
Modified Files:
        monetdb5/extras/crackers/crackers.mx
        monetdb5/extras/crackers/crackers_holistic.c
        monetdb5/extras/crackers/crackers_holistic.h
        monetdb5/extras/crackers/crackers_selecthol_ops.mx
        monetdb5/extras/crackers/crackers_selectholpl_ops.mx
        monetdb5/extras/crackers/crackers_selectholst_ops.mx
        monetdb5/extras/crackers/crackers_sidewayshol.mx
Branch: holindex
Log Message:

Using isIdleQuery as paremeter in the appropriate cracking operators.


diffs (truncated from 544 to 300 lines):

diff --git a/monetdb5/extras/crackers/crackers.mx 
b/monetdb5/extras/crackers/crackers.mx
--- a/monetdb5/extras/crackers/crackers.mx
+++ b/monetdb5/extras/crackers/crackers.mx
@@ -271,7 +271,7 @@ address CRKselectholValue_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
 
-command selecthol(b:bat[:oid,:@2],l:@2,h:@2,li:bit,hi:bit):bat[:oid,:@2]
+command selecthol(b:bat[:oid,:@2],l:@2,h:@2,li:bit,hi:bit,iq:bit):bat[:oid,:@2]
 address CRKselectholBounds_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
@@ -286,7 +286,7 @@ address CRKuselectholValue_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
 
-command uselecthol(b:bat[:any_1,:@2],l:@2,h:@2,li:bit,hi:bit):bat[:any_1,:void]
+command 
uselecthol(b:bat[:any_1,:@2],l:@2,h:@2,li:bit,hi:bit,iq:bit):bat[:any_1,:void]
 address CRKuselectholBounds_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
@@ -351,7 +351,7 @@ address CRKselectholplValue_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
 
-command selectholpl(b:bat[:oid,:@2],l:@2,h:@2,li:bit,hi:bit):bat[:oid,:@2]
+command 
selectholpl(b:bat[:oid,:@2],l:@2,h:@2,li:bit,hi:bit,iq:bit):bat[:oid,:@2]
 address CRKselectholplBounds_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
@@ -366,7 +366,7 @@ address CRKuselectholplValue_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
 
-command 
uselectholpl(b:bat[:any_1,:@2],l:@2,h:@2,li:bit,hi:bit):bat[:any_1,:void]
+command 
uselectholpl(b:bat[:any_1,:@2],l:@2,h:@2,li:bit,hi:bit,iq:bit):bat[:any_1,:void]
 address CRKuselectholplBounds_@2
 comment "Retrieve the subset using a cracker
         index producing preferably a BATview.";
diff --git a/monetdb5/extras/crackers/crackers_holistic.c 
b/monetdb5/extras/crackers/crackers_holistic.c
--- a/monetdb5/extras/crackers/crackers_holistic.c
+++ b/monetdb5/extras/crackers/crackers_holistic.c
@@ -32,7 +32,7 @@ MT_Lock CRKIndexLock;
 pthread_rwlock_t CRKFirstPieceRWLock;
 
 
-int isIdleQuery = 0;
+//int isIdleQuery = 0;
 IdleFuncPtr IdleFunc;
 
 str
@@ -371,6 +371,7 @@ CRKrandomCrack(int *ret)
        int low=0, hgh=0;
        int *t;
        int temp=0;
+       bit isIdleQuery=TRUE;
        oid posl,posh,p;
        FILE *ofp1;
        int dummy = 0;
@@ -378,7 +379,7 @@ CRKrandomCrack(int *ret)
        
        bit inclusive=TRUE;
        FrequencyNode *fs = getFrequencyStruct('A');    
-       isIdleQuery=1;
+//     isIdleQuery=1;
        ofp1 = fopen(outputFilename1,"a");
        (void) ret;
        max_node=findMax(fs);
@@ -400,7 +401,7 @@ CRKrandomCrack(int *ret)
                        hgh=temp;
                }
        /*fprintf(stderr,"posl = "OIDFMT" posh = "OIDFMT" low = %d hgh = %d 
inclusive = %d", posl,posh,low,hgh,inclusive );*/
-               CRKselectholBounds_int(&dummy, &bid, &low, &hgh, &inclusive, 
&inclusive);
+               CRKselectholBounds_int(&dummy, &bid, &low, &hgh, &inclusive, 
&inclusive,&isIdleQuery);
                fprintf(ofp1,"%d\n",max_node->bid);
                
        }
@@ -408,7 +409,7 @@ CRKrandomCrack(int *ret)
        fclose(ofp1);
 
        /*printFrequencyStruct(fs);*/
-       isIdleQuery=0;
+//     isIdleQuery=0;
 
 
        return MAL_SUCCEED;
@@ -423,12 +424,13 @@ CRKrandomCrackST(int *ret)
         BAT *b;
         int low=0, hgh=0;
         int *t;
-        int temp=0;
+        //bit isIdleQuery=TRUE;
+       int temp=0;
         oid posl,posh,p;
 
         bit inclusive=TRUE;
         FrequencyNode *fs = getFrequencyStruct('A');
-        isIdleQuery=1;
+        //isIdleQuery=1;
         max_node=findMax(fs);
         if(max_node!=NULL && max_node->weight > 0)
        {
@@ -450,7 +452,7 @@ CRKrandomCrackST(int *ret)
                 CRKselectholstBounds_int(ret, &bid, &low, &hgh, &inclusive, 
&inclusive);
         }
 
-        isIdleQuery=0;
+        //isIdleQuery=0;
 
         *ret = 0;
         return MAL_SUCCEED;
diff --git a/monetdb5/extras/crackers/crackers_holistic.h 
b/monetdb5/extras/crackers/crackers_holistic.h
--- a/monetdb5/extras/crackers/crackers_holistic.h
+++ b/monetdb5/extras/crackers/crackers_holistic.h
@@ -36,7 +36,7 @@ typedef struct frequency{
 }FrequencyNode;
 
 typedef  str (*IdleFuncPtr)(int *);
-crackers_export int isIdleQuery;
+//crackers_export int isIdleQuery;
 crackers_export MT_Lock CRKIndexLock;
 crackers_export pthread_rwlock_t CRKFirstPieceRWLock;
 
diff --git a/monetdb5/extras/crackers/crackers_selecthol_ops.mx 
b/monetdb5/extras/crackers/crackers_selecthol_ops.mx
--- a/monetdb5/extras/crackers/crackers_selecthol_ops.mx
+++ b/monetdb5/extras/crackers/crackers_selecthol_ops.mx
@@ -54,8 +54,8 @@ All Rights Reserved.
  * @- Exported signatures
  */
 @= SelectholFunctions_decl
-crackers_export str CRKselectholBounds_@1(int *vid, int *bid, @1 *low, @1 
*hgh, bit *inclusiveLow, bit *inclusiveHgh);
-crackers_export str CRKuselectholBounds_@1(int *vid, int *bid, @1 *low, @1 
*hgh, bit *inclusiveLow, bit *inclusiveHgh);
+crackers_export str CRKselectholBounds_@1(int *vid, int *bid, @1 *low, @1 
*hgh, bit *inclusiveLow, bit *inclusiveHgh,bit *isIdleQuery);
+crackers_export str CRKuselectholBounds_@1(int *vid, int *bid, @1 *low, @1 
*hgh, bit *inclusiveLow, bit *inclusiveHgh, bit *isIdleQuery);
 crackers_export str CRKselectholValue_@1(int *vid, int *bid, @1 *value);
 crackers_export str CRKuselectholValue_@1(int *vid, int *bid, @1 *value);
 crackers_export str CRKselecthol_@1(int *vid, int *bid, @1 *low, @1 *hgh);
@@ -85,47 +85,51 @@ crackers_export str CRKthetauselecthol_@
 @= SelectholFunctions_impl
 
 str
-CRKselectholBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, 
bit *inclusiveHgh){             
+CRKselectholBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, 
bit *inclusiveHgh, bit *isIdleQuery){           
        if (@2_EQ(low,ATOMnilptr(TYPE_@1),@3@1))
-               return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, 
TRUE);
+               return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, 
TRUE, isIdleQuery);
        else if (@2_EQ(hgh,ATOMnilptr(TYPE_@1),@3@1))
-               return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, 
TRUE);
+               return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, 
TRUE, isIdleQuery);
        else
-               return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, 
inclusiveHgh, TRUE);
+               return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, 
inclusiveHgh, TRUE, isIdleQuery);
 }
 
 str
-CRKuselectholBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit 
*inclusiveLow, bit *inclusiveHgh){
+CRKuselectholBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit 
*inclusiveLow, bit *inclusiveHgh, bit *isIdleQuery){
        if (@2_EQ(low,ATOMnilptr(TYPE_@1),@3@1))
-               return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, 
FALSE);
+               return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, 
FALSE, isIdleQuery);
        else if (@2_EQ(hgh,ATOMnilptr(TYPE_@1),@3@1))
-               return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, 
FALSE);
+               return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, 
FALSE, isIdleQuery);
        else
-               return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, 
inclusiveHgh, FALSE);
+               return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, 
inclusiveHgh, FALSE, isIdleQuery);
 }
 
 str
 CRKselectholValue_@1(int *vid, int *bid, @1 *value){
        bit inclusive = TRUE;
-       return CRKuselectholBounds_@1(vid, bid, value, value, &inclusive, 
&inclusive);
+       bit isIdleQuery=FALSE;
+       return CRKuselectholBounds_@1(vid, bid, value, value, &inclusive, 
&inclusive, &isIdleQuery);
 }
 
 str
 CRKuselectholValue_@1(int *vid, int *bid, @1 *value){
        bit inclusive = TRUE;
-       return CRKuselectholBounds_@1(vid, bid, value, value, &inclusive, 
&inclusive);
+       bit isIdleQuery=FALSE;
+       return CRKuselectholBounds_@1(vid, bid, value, value, &inclusive, 
&inclusive, &isIdleQuery);
 }
 
 str
 CRKselecthol_@1(int *vid, int *bid, @1 *low, @1 *hgh){
        bit inclusive = TRUE;
-       return CRKselectholBounds_@1(vid, bid, low, hgh, &inclusive, 
&inclusive);
+       bit isIdleQuery=FALSE;
+       return CRKselectholBounds_@1(vid, bid, low, hgh, &inclusive, 
&inclusive, &isIdleQuery);
 }
 
 str
 CRKuselecthol_@1(int *vid, int *bid, @1 *low, @1 *hgh){
        bit inclusive = TRUE;
-       return CRKuselectholBounds_@1(vid, bid, low, hgh, &inclusive, 
&inclusive);
+       bit isIdleQuery=FALSE;
+       return CRKuselectholBounds_@1(vid, bid, low, hgh, &inclusive, 
&inclusive, &isIdleQuery);
 }
 
 str
@@ -133,6 +137,7 @@ CRKthetaselecthol_@1(int *vid, int *bid,
        ptr nilptr = ATOMnilptr(TYPE_@1); 
        char *op = *OP; 
        bit lin = TRUE, rin = TRUE;
+       bit isIdleQuery=FALSE;
        @1 *low = nilptr, *high = nilptr;
 
        if (op[0] == '=') {
@@ -148,7 +153,7 @@ CRKthetaselecthol_@1(int *vid, int *bid,
                throw(MAL, "crackers.thetaselecthol", "unknown operator");
        }
 
-       return CRKselectholBounds_@1(vid, bid, low, high, &lin, &rin);
+       return CRKselectholBounds_@1(vid, bid, low, high, &lin, &rin, 
&isIdleQuery);
 }
 
 str
@@ -156,6 +161,7 @@ CRKthetauselecthol_@1(int *vid, int *bid
        ptr nilptr = ATOMnilptr(TYPE_@1); 
        char *op = *OP; 
        bit lin = TRUE, rin = TRUE;
+       bit isIdleQuery=FALSE;
        @1 *low = nilptr, *high = nilptr;
 
        if (op[0] == '=') {
@@ -170,7 +176,7 @@ CRKthetauselecthol_@1(int *vid, int *bid
                throw(MAL, "crackers.thetauselecthol", "unknown operator");
        }
 
-       return CRKuselectholBounds_@1(vid, bid, low, high, &lin, &rin);
+       return CRKuselectholBounds_@1(vid, bid, low, high, &lin, &rin, 
&isIdleQuery);
 }
 
 
@@ -373,7 +379,7 @@ createView:
 
                        FN=searchBAT(FrequencyStructA,*bid);
                                                
-                       if (isIdleQuery!=1)
+                       if (*isIdleQuery==FALSE)
                                FN->f1 = FN->f1 + 1;
 
                        FN->c = FN->c + 2;
@@ -428,7 +434,7 @@ createView:
 
        FN=searchBAT(FrequencyStructA,*bid);
        
-       if (isIdleQuery!=1)
+       if (*isIdleQuery==FALSE)
        {
                FN->f1 = FN->f1 + 1;
        }
@@ -564,7 +570,7 @@ createView:
 
 
        
-       if((foundLow!=0 && foundHgh!=0)&&(isIdleQuery!=1)) FN->f2 = FN->f2 + 1;
+       if((foundLow!=0 && foundHgh!=0)&&(*isIdleQuery==FALSE)) FN->f2 = FN->f2 
+ 1;
        /* If one or both of the result view bounds were not found using the
        index then we have to crack */
 
@@ -913,12 +919,12 @@ To do that, we first search the index to
 know and which parts we have to crack. Then we crack, if necessary,
 the appropriate pieces, update the index and return the result */
 static str
-CRKRangeTree_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit 
*inclusiveHgh, bit tail){ 
+CRKRangeTree_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit 
*inclusiveHgh, bit tail, bit *isIdleQuery){       
        @:RangeSelectBody(@1,@2,@3,@4,)@
 }
 
 static str
-CRKRangeLeftNilTree_@1(int *vid, int *bid, @1 *hgh, bit *inclusiveHgh, bit 
tail){
+CRKRangeLeftNilTree_@1(int *vid, int *bid, @1 *hgh, bit *inclusiveHgh, bit 
tail, bit *isIdleQuery){
        BAT *b,*c,*bo;
        BAT *view;
        int  m;
@@ -929,6 +935,8 @@ CRKRangeLeftNilTree_@1(int *vid, int *bi
        int createIndex=0;      
        if (*inclusiveHgh == TRUE) HBound = FALSE;
        else    HBound = TRUE;                          
+ 
+       (void) isIdleQuery;
 
        m = existsCrackerIndex(*bid);
        assert(0);
@@ -1014,7 +1022,7 @@ CRKRangeLeftNilTree_@1(int *vid, int *bi
 }
 
 static str
-CRKRangeRightNilTree_@1(int *vid, int *bid, @1 *low, bit *inclusiveLow, bit 
tail){
+CRKRangeRightNilTree_@1(int *vid, int *bid, @1 *low, bit *inclusiveLow, bit 
tail, bit *isIdleQuery){
        BAT *b,*c,*bo;
        BAT *view;
        int  m;
@@ -1026,6 +1034,7 @@ CRKRangeRightNilTree_@1(int *vid, int *b
        int createIndex=0;
        m = existsCrackerIndex(*bid);
        assert(0);
+       (void) isIdleQuery;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to