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

Use dispatcher in order to select the appropiate holistic indexing strategy.


diffs (142 lines):

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
@@ -406,7 +406,25 @@ CRKrandomCrack(int *ret)
        
        return MAL_SUCCEED;
 }
+/*holistic indexing strategy dispatcher*/
+dbl
+changeWeight(FrequencyNode* node,int N,int L1){
+       char* p;
+       int j;
 
+        p = getenv("HOLSTRATEGY");
+        if (p == NULL)
+                j = 0;
+        else
+                j = atoi(p);
+
+       if (j==2)
+               return changeWeight_2(node,N,L1);
+       else if (j==3)
+               return changeWeight_3(node,N,L1);
+       else
+                return changeWeight_1(node,N,L1);
+}
 /*This function is used during idle time for all the cost models*/
 str
 CRKrandomCrackST(int *ret)
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
@@ -49,6 +49,7 @@ crackers_export FrequencyNode* searchBAT
 crackers_export double changeWeight_1(FrequencyNode* node,int N,int L1);
 crackers_export double changeWeight_2(FrequencyNode* node,int N,int L1);
 crackers_export double changeWeight_3(FrequencyNode* node,int N,int L1);
+crackers_export double changeWeight(FrequencyNode* node,int N,int L1);
 crackers_export FrequencyNode* findMax(FrequencyNode* head);
 crackers_export FrequencyNode* findOtherMax(FrequencyNode* head,int bat_id);
 crackers_export FrequencyNode* pickRandom(FrequencyNode* head);
diff --git a/monetdb5/extras/crackers/crackers_selectholpl_ops.mx 
b/monetdb5/extras/crackers/crackers_selectholpl_ops.mx
--- a/monetdb5/extras/crackers/crackers_selectholpl_ops.mx
+++ b/monetdb5/extras/crackers/crackers_selectholpl_ops.mx
@@ -280,7 +280,7 @@ CRKrandomholpl_@1(int *bid, bit *inclusi
                                CRKinitFrequencyStruct(0,*bid);
                                FN=searchBAT(FrequencyStructA,*bid);
                                FN->c = FN->c + 1;
-                               FN->weight = 
changeWeight_1(FN,countBatElements,L1);    
+                               FN->weight = 
changeWeight(FN,countBatElements,L1);      
                        }
                        if ((vl == 1) && (*t == *low) && (*inclusiveLow == 
TRUE))
                                vl = vl - 1;
@@ -367,7 +367,7 @@ CRKrandomholpl_@1(int *bid, bit *inclusi
                                addCrackerIndex_@1(m, low, *inclusiveLow, _vl, 
c);
                                FN->c = FN->c + 1;
                                if(FN->weight > 0)
-                                       FN->weight = 
changeWeight_1(FN,countBatElements,L1);            
+                                       FN->weight = 
changeWeight(FN,countBatElements,L1);              
                        }
                        if ((vl == 1) && (*t == *low) && (*inclusiveLow == 
TRUE))
                                vl = vl - 1;
@@ -382,7 +382,7 @@ CRKrandomholpl_@1(int *bid, bit *inclusi
                if ((vl == 0) && (*t < *low) && (*inclusiveLow == TRUE))
                        vl = vl + 1;
                if(FN->weight > 0)
-                       FN->weight = changeWeight_1(FN,countBatElements,L1);
+                       FN->weight = changeWeight(FN,countBatElements,L1);
        }
 
        //gettimeofday(&tv1,0); ct+=dt(tv0,tv1); tv0=tv1;       
@@ -602,7 +602,7 @@ createView:
                                                
                        FN->f1 = FN->f1 + 1;
                        FN->c = FN->c + 2;
-                       FN->weight = changeWeight_1(FN,countBatElements,L1);
+                       FN->weight = changeWeight(FN,countBatElements,L1);
 
                        /*printFrequencyStruct(FrequencyStructA);*/
                        BBPincref(b->batCacheid,TRUE);
@@ -834,7 +834,7 @@ createView:
                                        FN->c = FN->c + 1;
                                        countBatElements=BATcount(b);
                                        if(FN->weight > 0)
-                                               FN->weight = 
changeWeight_1(FN,countBatElements,L1);
+                                               FN->weight = 
changeWeight(FN,countBatElements,L1);
                                }
                                if ((vl == 1) && (*t == *low) && (*inclusiveLow 
== TRUE))
                                        vl = vl - 1;
@@ -871,7 +871,7 @@ createView:
                                        FN->c = FN->c + 1;
                                        countBatElements=BATcount(b);
                                        if(FN->weight > 0)
-                                               FN->weight = 
changeWeight_1(FN,countBatElements,L1);
+                                               FN->weight = 
changeWeight(FN,countBatElements,L1);
                                }
                        vl = cl1;
                        if ((vl == 0) && (*t < *low) && (*inclusiveLow == TRUE))
@@ -887,7 +887,7 @@ createView:
                vh = ch2;
                countBatElements=BATcount(b);
                if(FN->weight > 0)
-                       FN->weight = changeWeight_1(FN,countBatElements,L1);
+                       FN->weight = changeWeight(FN,countBatElements,L1);
        }
 
 
@@ -1415,7 +1415,7 @@ CRKRangeLeftNilTree_@1(int *vid, int *bi
                FN=searchBAT(FrequencyStructA,*bid);                            
        
                FN->f1 = FN->f1 + 1;
                FN->c = FN->c + 1;
-               FN->weight = changeWeight_1(FN,countBatElements,L1);    
+               FN->weight = changeWeight(FN,countBatElements,L1);      
 
                BBPincref(b->batCacheid,TRUE);
                BBPunfix(bo->batCacheid);
@@ -1500,7 +1500,7 @@ CRKRangeLeftNilTree_@1(int *vid, int *bi
                                FN->c = FN->c + 1;
                                countBatElements=BATcount(b);
                                if(FN->weight > 0)
-                                       FN->weight = 
changeWeight_1(FN,countBatElements,L1);
+                                       FN->weight = 
changeWeight(FN,countBatElements,L1);
                        }
                }
                pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
@@ -1592,7 +1592,7 @@ CRKRangeRightNilTree_@1(int *vid, int *b
                FN=searchBAT(FrequencyStructA,*bid);                            
        
                FN->f1 = FN->f1 + 1;
                FN->c = FN->c + 1;
-               FN->weight = changeWeight_1(FN,countBatElements,L1);
+               FN->weight = changeWeight(FN,countBatElements,L1);
 
                BBPincref(b->batCacheid,TRUE);
                BBPunfix(bo->batCacheid);
@@ -1677,7 +1677,7 @@ CRKRangeRightNilTree_@1(int *vid, int *b
                                FN->c = FN->c + 1;
                                countBatElements=BATcount(b);
                                if(FN->weight > 0)
-                                       FN->weight = 
changeWeight_1(FN,countBatElements,L1);
+                                       FN->weight = 
changeWeight(FN,countBatElements,L1);
                        }
                }
                pthread_rwlock_unlock(&CrackerIndex[m].columnRWLock);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to