Changeset: 821e336bd0fa for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=821e336bd0fa
Added Files:
        monetdb5/extras/crackers/crackers_sideways.mx
        monetdb5/extras/crackers/opt_sidcrack.mx
Modified Files:
        monetdb5/extras/crackers/60_crackers.mal
        monetdb5/extras/crackers/Makefile.ag
        monetdb5/extras/crackers/crackers.mx
        monetdb5/extras/crackers/crackers_core_unordered.mx
        monetdb5/optimizer/optimizer.mal
Branch: holindex
Log Message:

1st attempt to bring sideways cracking back.


diffs (truncated from 3788 to 300 lines):

diff --git a/monetdb5/extras/crackers/60_crackers.mal 
b/monetdb5/extras/crackers/60_crackers.mal
--- a/monetdb5/extras/crackers/60_crackers.mal
+++ b/monetdb5/extras/crackers/60_crackers.mal
@@ -20,5 +20,6 @@ library crackers;
 include opt_selcrack;
 include opt_selcrackst;
 include opt_selcrackhol;
+include opt_sidcrack;
 include crackers;
 include crackers_holistic;
diff --git a/monetdb5/extras/crackers/Makefile.ag 
b/monetdb5/extras/crackers/Makefile.ag
--- a/monetdb5/extras/crackers/Makefile.ag
+++ b/monetdb5/extras/crackers/Makefile.ag
@@ -42,9 +42,11 @@ lib_crackers = {
                          crackers_selectst_ops.mx \
                          crackers_selecthol_ops.mx \
                          crackers_updates.mx \
+                         crackers_sideways.mx \
                          opt_selcrack.mx \
                          opt_selcrackst.mx \
-                         opt_selcrackhol.mx
+                         opt_selcrackhol.mx \
+                         opt_sidcrack.mx
        LIBS = ../../tools/libmonetdb5 \
                   ../../../gdk/libbat \
                   ../../../common/stream/libstream \
@@ -59,6 +61,7 @@ headers_mal = {
                          opt_selcrack.mx \
                          opt_selcrackst.mx \
                          opt_selcrackhol.mx \
+                         opt_sidcrack.mx \
                          crackers_holistic.mal
 }
 
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
@@ -154,6 +154,23 @@ module crackers;
 @:TypeSwitch_1(CoreUnordered)@
 @:TypeSwitch_1(Validate)@
 @:TypeSwitch_1(Updates)@
+@:TypeSwitch_2(Sideways)@
+
+command getTotalStorage( ):void
+address CRKgetTotalStorage
+comment "Get the number of total tuples stored in sideways maps";
+
+command setStorageThreshold(threshold:lng):void
+address CRKsetStorageThreshold
+comment "set the maximum number of total tuples that can be stored in sideways 
maps";
+
+command fmclearReferences():void
+address CRKclearReferencesFullMaps
+comment "clear all references ";
+
+command fmremoveMap():void
+address CRKremoveFullMap
+comment "clear all debugging map ";
 
 #
 
@@ -409,6 +426,133 @@ comment "Validate whether a BAT is corre
         tail<=low, low<tail<=hgh, tail>hgh,
         respectively@3.";
 @
+@= Sideways
+command getMap( b:bat[:oid,:@1], bp:bat[:oid,:@2] ):bat[:@1,:@2]
+address getCrackerMap
+comment "Get a certain map";
+
+command DeleteMap( b:bat[:oid,:@1], bp:bat[:oid,:@2] ):void
+address DeleteCrackerMap
+comment "Throw away a certain map"; 
+
+command insert( b:bat[:oid,:@1], bp:bat[:oid,:@2], c:bat[:@1,:@2]):void
+address CRKinsert
+comment "Keep the insertions BAT separatelly and merge in the future on demand 
with the Ripple";
+
+command printPendingInsertions( b:bat[:oid,:@1], bp:bat[:oid,:@2]):void
+address CRKprintPendingInsertions
+comment "Print the pending insertions";
+
+command extendCrackerMap(b:bat[:oid,:@1], bp:bat[:oid,:@2], P:lng):void
+address CRKextendCrackerMap
+comment "Extend the cracker map by P positions";
+
+command sizePendingInsertions(b:bat[:oid,:@1], bp:bat[:oid,:@2]):void
+address CRKsizePendingInsertions
+comment "Get the size of the pending insertions for this map";
+
+
+
+command 
hselect(b:bat[:oid,:@1],bp:bat[:oid,:@2],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@1]
+address CRKhselectBoundsSideways_@1_@2
+comment "Retrieve the subset head using a cracker
+        index producing preferably a BATview.";
+
+command 
tselect(b:bat[:oid,:@1],bp:bat[:oid,:@2],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKtselectBoundsSideways_@1_@2
+comment "Retrieve the subset tail using a cracker
+        index producing preferably a BATview.";
+
+command 
dselect(b:bat[:oid,:@1],bp:bat[:oid,:@2],l:@1,h:@1,li:bit,hi:bit,l2:@2,h2:@2,li2:bit,hi2:bit):bat[:oid,:bit]
+address CRKdselectBoundsSideways_@1_@2
+comment "Crack based on @1 and evaluate the @2 disjunctive predicate outside 
the cracked area. Return a bit vector.";
+
+
+command joinselect( b:bat[:oid,:@1],bp:bat[:oid,:@2], pivot:bat[:oid,:bit], 
cl:@1, ch:@1, cli:bit, chi:bit, l:@2, h:@2, li:bit, hi:bit ):bat[:oid,:bit]
+address CRKjoinSelectSideways_P_@1_@2
+comment "Use the pivot. For each tuple in pivot with a 1, check if the 
respective tuple (in the same position)
+        in the tail of cpair satisfies the range restriction. If not mark the 
pivot BUN as 0.";
+
+command jointhetaselect( b:bat[:oid,:@1],bp:bat[:oid,:@2], 
pivot:bat[:oid,:bit], cl:@1, ch:@1, cli:bit, chi:bit, l:@2, 
op:str):bat[:oid,:bit]
+address CRKjointhetaSelectSideways_P_@1_@2
+comment "Use the pivot. For each tuple in pivot with a 1, check if the 
respective tuple (in the same position)
+        in the tail of cpair satisfies the range restriction. If not mark the 
pivot BUN as 0.";
+
+command djoinselect( b:bat[:oid,:@1],bp:bat[:oid,:@2], pivot:bat[:oid,:bit], 
l:@2, h:@2, li:bit, hi:bit ):bat[:oid,:bit]
+address CRKdjoinSelectSideways_P_@1_@2
+comment "Use the pivot. For each tuple in pivot with a 0, check if the 
respective tuple (in the same position)
+        in the tail of cpair satisfies the range restriction. If yes mark the 
pivot BUN as 1.";
+
+
+command project( b:bat[:oid,:@1],bp:bat[:oid,:@2], 
l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKProjectCrack_@1_@2
+comment "Sync map and project the tail";
+
+command project( 
b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:bit],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKProject_@1_@2
+comment "Sync map and project tail based on pivot";
+
+command projectH( 
b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:bit],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@1]
+address CRKProjectH_@1_@2
+comment "Sync map and project head based on pivot";
+
+command positionproject( 
b:bat[:oid,:@1],bp:bat[:oid,:@2],PositionPivot:bat[:oid,:oid],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKPositionProject_@1_@2
+comment "Sync the cracking pair and project the tail. The pivot holds the 
positions to be projected";
+
+command markedproject( 
b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:bit],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKMarkedProject_@1_@2
+comment "Sync the cracking pair and project the tail. The result bat has a 
marked head";
+
+command dproject( 
b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:bit]):bat[:oid,:@2]
+address CRKdProject_@1_@2
+comment "Sync the cracking pair and project the tail. Use for disjunctive 
queries that require a larger bit vector";
+
+command dprojectH( 
b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:bit]):bat[:oid,:@1]
+address CRKdProjectH_@1_@2
+comment "Sync the cracking pair and project the head. Use for disjunctive 
queries that require a larger bit vector";
+
+command positionproject( 
b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:oid]):bat[:oid,:@2]
+address CRKdPositionProject_@1_@2
+comment "Sync the cracking pair and project the tail. Use position based 
pivot";
+
+command 
pmselect(b:bat[:oid,:@1],bp:bat[:oid,:@2],l:@1,h:@1,li:bit,hi:bit,l2:@2,h2:@2,li2:bit,hi2:bit):bat[:oid,:bit]
+address CRKselectBoundsIncrementalSideways_@1_@2
+comment "Crack based on @1 and evaluate the @2 conjunctive predicate. Return a 
bit vector.";
+
+command 
pmtselect(b:bat[:oid,:@1],bp:bat[:oid,:@2],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKselectBoundsTailIncrementalSideways_@1_@2
+comment "Crack based on @1 and project the @2 tail .";
+
+command pmjoinselect(b:bat[:oid,:@1],bp:bat[:oid,:@2], pivot:bat[:oid,:bit], 
cl:@1, ch:@1, cli:bit, chi:bit, l:@2, h:@2, li:bit, hi:bit ):bat[:oid,:bit]
+address CRKjoinSelectIncrementalSideways_@1_@2
+comment "Use the pivot. For each tuple in pivot with a 1, check if the 
respective tuple (in the same position)
+        in the tail of cpair(collection of pieces) satisfies the range 
restriction. If not mark the pivot BUN as 0.";
+
+command 
pmproject(b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:bit],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKProjectIncrementalSideways_@1_@2
+comment "Sync the map and project the tail based on the pivot";
+
+command 
pmmaxTail(b:bat[:oid,:@1],bp:bat[:oid,:@2],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@2]
+address CRKMaxTailIncrementalSideways_@1_@2
+comment "Sync/crack the map and get the max of the tail";
+
+command pmaddReference(b:bat[:oid,:@1],bp:bat[:oid,:@2]):void
+address CRKaddReference
+comment "add bp reference to map set of b";
+
+command pmclearReferences(b:bat[:oid,:@1]):void
+address CRKclearReferences
+comment "clear all references to b";
+
+command fmaddReference(b:bat[:oid,:@1],bp:bat[:oid,:@2]):void
+address CRKaddReferenceFullMaps
+comment "add bp reference to map set of b";
+
+command fmcreateMap(b:bat[:oid,:@1],bp:bat[:oid,:@2]):void
+address CRKcreateFullMap_@1_@2
+comment "make new map for debugging";
+@
 
  
 @h
@@ -441,6 +585,7 @@ comment "Validate whether a BAT is corre
 #include "crackers_core_unordered.h"
 #include "crackers_AVL_tree.h"
 #include "crackers_updates.h"
+#include "crackers_sideways.h"
 
 #ifdef LIBCRACKERS 
 extern int maxCrackMap;
diff --git a/monetdb5/extras/crackers/crackers_core_unordered.mx 
b/monetdb5/extras/crackers/crackers_core_unordered.mx
--- a/monetdb5/extras/crackers/crackers_core_unordered.mx
+++ b/monetdb5/extras/crackers/crackers_core_unordered.mx
@@ -79,6 +79,8 @@ All Rights Reserved.
 #ifdef LIBCRACKERS
 /* Signatures shared within the crackers module/library */
 @:TypeSwitch(operations,_decl)@
+@:TypeSwitch_4(operationsSideways,_decl)@
+@:TypeSwitch_2(operationsSideways_str,_decl)@
 #endif
 
 /* Exported signatures */
@@ -108,6 +110,35 @@ str CRKcrackUnorderedZero_@2_@1( BAT *b,
 str CRKcrackUnorderedThree_@2_@3_@1( BAT *b, @1 low, @1 hgh, oid first, oid 
last, oid *posl, oid *posh);
 str CRKcrackUnorderedThreeCopy_@2_@3_@1( BAT *b, @1 low, @1 hgh, oid first, 
oid last, oid *posl, oid *posh, BAT *bc);
 @
+@= operationsSideways
+@:crackInTwoUnorderedPiecesSideways@6(@1,@2,LE,LE,GT,@3,@4)@
+@:crackInTwoUnorderedPiecesSideways@6(@1,@2,RE,LT,GE,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways@6(@1,@2,LO,RE,LE,GT,LE,GT,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways@6(@1,@2,LE,RE,LT,GE,LE,GT,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways@6(@1,@2,LO,RO,LE,GT,LT,GE,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways@6(@1,@2,LE,RO,LT,GE,LT,GE,@3,@4)@
+@
+@= operationsSideways_str
+@:crackInTwoUnorderedPiecesSideways_str@6(@1,,LE,LE,GT,@3,@4)@
+@:crackInTwoUnorderedPiecesSideways_str@6(@1,,RE,LT,GE,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways_str@6(@1,,LO,RE,LE,GT,LE,GT,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways_str@6(@1,,LE,RE,LT,GE,LE,GT,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways_str@6(@1,,LO,RO,LE,GT,LT,GE,@3,@4)@
+@:crackInThreeUnorderedPiecesSideways_str@6(@1,,LE,RO,LT,GE,LT,GE,@3,@4)@
+@
+@= crackInTwoUnorderedPiecesSideways_decl
+str CRKcrackUnorderedZeroSideways_@3_@1_@2( BAT *b, @1 mval, oid first, oid 
last, oid *pos);
+@
+@= crackInTwoUnorderedPiecesSideways_str_decl
+str CRKcrackUnorderedZeroSideways_@3_@1_str( BAT *b, @1 mval, oid first, oid 
last, oid *pos);
+@
+@= crackInThreeUnorderedPiecesSideways_decl
+str CRKcrackUnorderedThreeSideways_@3_@4_@1_@2( BAT *b, @1 low, @1 hgh, oid 
first, oid last, oid *posl, oid *posh);
+@
+@= crackInThreeUnorderedPiecesSideways_str_decl
+str CRKcrackUnorderedThreeSideways_@3_@4_@1_str( BAT *b, @1 low, @1 hgh, oid 
first, oid last, oid *posl, oid *posh);
+@
+
 @c
 /*
  * @+ Implementation
@@ -120,6 +151,8 @@ str CRKcrackUnorderedThreeCopy_@2_@3_@1(
 
 /* Functions shared within the crackers module/library */
 @:TypeSwitch(operations,_impl)@
+@:TypeSwitch_4(operationsSideways,_impl)@
+@:TypeSwitch_2(operationsSideways_str,_impl)@
 
 /* Exported functions */
 @:TypeSwitch(CoreUnorderedFunctions_impl,)@
@@ -470,6 +503,45 @@ CRKcrackUnorderedThreeCopy_@2_@3_@1( BAT
         *@9 = @4;
         *@8 = @5;
 @
+@= shuffleSideways
+       hdummy = *(@1*) @3;
+       *(@1*) @3= *(@1*) @4;
+        *(@1*) @4= hdummy;
+
+       tdummy= *(@2*) @5;
+        *(@2*) @5= *(@2*) @6;
+        *(@2*) @6 = (@2)tdummy;
+@= shuffleSidewaysStr
+       hdummy = *(@1*) @2;
+       *(@1*) @2= *(@1*) @3;
+        *(@1*) @3= hdummy;
+
+       switch (b->T->width) {
+       case 1:
+               tdummy= (var_t)*(unsigned char*) @4;
+               *(unsigned char*) @4= *(unsigned char*) @5;
+               *(unsigned char*) @5 = (unsigned char)tdummy;
+               break;
+       case 2:
+               tdummy= (var_t)*(unsigned short*) @4;
+               *(unsigned short*) @4= *(unsigned short*) @5;
+               *(unsigned short*) @5 = (unsigned short)tdummy;
+               break;
+#if SIZEOF_VAR_T == 8
+       case 4:
+               tdummy= (var_t)*(unsigned int*) @4;
+               *(unsigned int*) @4= *(unsigned int*) @5;
+               *(unsigned int*) @5 = (unsigned int)tdummy;
+               break;
+#endif
+       default:
+               tdummy= *(var_t*) @4;
+               *(var_t*) @4= *(var_t*) @5;
+               *(var_t*) @5 = tdummy;
+               break;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to