Update of /cvsroot/monetdb/MonetDB5/src/modules/mal/crackers
In directory
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7162/src/modules/mal/crackers
Modified Files:
crackers_joins.mx crackers.mx
Log Message:
improving and fixing bugs in sort and crack band join
avoid unnesessary view creation and make sure that all tuples are considered
from the left side
correct results are produced now but exhaustive (for every left tuple) cracking
does not seem the way to go
Index: crackers_joins.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/crackers/crackers_joins.mx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- crackers_joins.mx 18 Jan 2008 15:16:27 -0000 1.8
+++ crackers_joins.mx 23 Jan 2008 13:15:32 -0000 1.9
@@ -37,6 +37,7 @@
/* Exported signatures */
@:TypeSwitch_1(JoinFunctions_decl1)@
crackers_export str CRKbatCount(lng *count, int *bid);
+crackers_export str CRKmaterializeH(int *res, int *bid);
/* #define DEBUG_CRACKERS_JOIN to enable debug trace */
#endif /* _CRACKERS_JOINS_H */
@@ -141,6 +142,13 @@
return MAL_SUCCEED;
}
+str CRKmaterializeH(int *res, int *bid){
+ BAT *b=BATdescriptor(*bid);
+ b=BATmaterializeh(b);
+ BBPunfix(b->batCacheid);
+ (void)res;
+ return MAL_SUCCEED;
+}
@
@@ -376,10 +384,14 @@
@= addPartialResult
- view = BATslice(b, vl, vh+1);
- viewCount = BATcount(view);
- curViewTupleHead = (oid*)Hloc(view,BUNfirst(view));
- for (i=0;i<viewCount;i++){
+ curViewTupleHead = (oid*)Hloc(b,BUNfirst(b)+vl);
+
+#ifdef DEBUG_CRACKERS_JOIN
+ printf("\n adding tuples "OIDFMT" to "OIDFMT" \n",vl,vh);
+ BATprint(b);
+#endif
+
+ for (j=vl;j<vh+1;j++){
*currentResTupleHead = *currentTupleLeftHead;
*currentResTupleTail = *curViewTupleHead;
@@ -389,18 +401,20 @@
}
- resCount += viewCount;
- BBPunfix(view->batCacheid);
+ resCount += (vh-vl) + 1;
@
@= sortInsertPartialResult
*currentResTupleHead = *currentTupleLeftHead;
- *currentResTupleTail = *Hloc(BATRight, currentTupleRight);
+ *currentResTupleTail = *(oid*)Hloc(BATRight, currentTupleRight);
currentTupleRight ++;
currentResTupleHead ++;
currentResTupleTail ++;
resCount++;
+
+ if (currentTupleRight == BUNlast(BATRight))
+ goto next;
@
@= crackDoubleSidedBound
@@ -1381,7 +1395,7 @@
}
str [EMAIL PROTECTED](int *resid, int *bidL, int *bidR, @1 *c1, @1 *c2, bit
*inclusiveLow, bit *inclusiveHgh){
- BAT *BATLeft, *b, *c, *res, *view;
+ BAT *BATLeft, *b, *c, *res;
int m;
@1 currentValue;
BUN currentTupleLeft;
@@ -1392,9 +1406,9 @@
oid vl=0, vh=0, posl, posh, _vl;
oid cl1=0, ch1=0, cl2=0, ch2=0;
int foundLow, foundHgh;
- oid viewCount, resCount=0;
+ oid resCount=0;
int gapL=0,gapH=0;
- oid i;
+ oid i,j;
if (*inclusiveHgh == TRUE) HBound = FALSE;
else HBound = TRUE;
@@ -1437,10 +1451,10 @@
foundLow = [EMAIL PROTECTED](low, *inclusiveLow,
CrackerIndex[m].Tree, c, BUNfirst(c),
- &cl1, &ch1, 0, BUNlast(b)-(oid)1);
+ &cl1, &ch1, 0, BUNlast(b)-1);
foundHgh = [EMAIL PROTECTED](hgh, *inclusiveHgh,
CrackerIndex[m].Tree, c, BUNfirst(c),
- &cl2, &ch2, 0, BUNlast(b)-(oid)1);
+ &cl2, &ch2, 0, BUNlast(b)-1);
if (cl1 != 0) cl1++;
if (cl2 != 0) cl2++;
@@ -1522,10 +1536,8 @@
hgh = currentValue + *c2;
currentTupleRight = [EMAIL PROTECTED](BATRight,&low);
- if (currentTupleRight == BUNlast(BATRight)){
- currentTupleLeft ++;
- continue;
- }
+ if (currentTupleRight == BUNlast(BATRight))
+ goto next;
if ((*(@1*)Tloc(BATRight, currentTupleRight) ==
low)&&(*inclusiveLow == TRUE)){
@:sortInsertPartialResult()@
@@ -1544,6 +1556,7 @@
}
}
+ next:;
currentTupleLeft ++;
}
Index: crackers.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/crackers/crackers.mx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- crackers.mx 15 Jan 2008 11:05:05 -0000 1.6
+++ crackers.mx 23 Jan 2008 13:15:32 -0000 1.7
@@ -532,6 +532,11 @@
address [EMAIL PROTECTED]
comment "Band Join two maps based on head values.
First sort the right BAT and then continuously binary search the right
BAT for each tuple of the left one";
+
+command materializeHead(b:bat[:oid,:@2]) :void
+address CRKmaterializeH
+comment "Materialize the head of BAT b";
+
@
@- Header file
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins