Changeset: 248aa39c54e9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=248aa39c54e9
Modified Files:
        monetdb5/modules/mal/Tests/mosaic_rle_subselect.mal
        monetdb5/modules/mal/Tests/mosaic_rle_subselect.stable.out
        monetdb5/modules/mal/mosaic.c
        monetdb5/modules/mal/mosaic.h
        monetdb5/modules/mal/mosaic_delta.c
        monetdb5/modules/mal/mosaic_delta.h
        monetdb5/modules/mal/mosaic_dict.c
        monetdb5/modules/mal/mosaic_dict.h
        monetdb5/modules/mal/mosaic_hdr.c
        monetdb5/modules/mal/mosaic_hdr.h
        monetdb5/modules/mal/mosaic_linear.c
        monetdb5/modules/mal/mosaic_linear.h
        monetdb5/modules/mal/mosaic_none.c
        monetdb5/modules/mal/mosaic_none.h
        monetdb5/modules/mal/mosaic_rle.c
        monetdb5/modules/mal/mosaic_rle.h
        monetdb5/modules/mal/mosaic_zone.c
        monetdb5/modules/mal/mosaic_zone.h
        monetdb5/optimizer/opt_mosaic.c
Branch: mosaic
Log Message:

Simplyfiying the iterator structure over mosaic blockS


diffs (truncated from 2188 to 300 lines):

diff --git a/monetdb5/modules/mal/Tests/mosaic_rle_subselect.mal 
b/monetdb5/modules/mal/Tests/mosaic_rle_subselect.mal
--- a/monetdb5/modules/mal/Tests/mosaic_rle_subselect.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_rle_subselect.mal
@@ -49,39 +49,3 @@ s:= algebra.subselect(b,nil:int,nil:int,
 io.print(s);
 xs:= mosaic.subselect(x,nil:int,nil:int,false,false,true);
 io.print(xs);
-
-c:= bat.new(:oid,:oid);
-bat.append(c,0@0);
-bat.append(c,3@0);
-io.print(c);
-
-s:= algebra.thetasubselect(b,c,50,"<");
-io.print(s);
-xs:= mosaic.thetasubselect(x,c,50,"<");
-io.print(xs);
-
-s:= algebra.thetasubselect(b,c,50,"<=");
-io.print(s);
-xs:= mosaic.thetasubselect(x,c,50,"<=");
-io.print(xs);
-
-s:= algebra.thetasubselect(b,c,50,">");
-io.print(s);
-xs:= mosaic.thetasubselect(x,c,50,">");
-io.print(xs);
-
-s:= algebra.thetasubselect(b,c,50,">=");
-io.print(s);
-xs:= mosaic.thetasubselect(x,c,50,">=");
-io.print(xs);
-
-s:= algebra.thetasubselect(b,c,50,"==");
-io.print(s);
-xs:= mosaic.thetasubselect(x,c,50,"==");
-io.print(xs);
-
-s:= algebra.thetasubselect(b,c,50,"!=");
-io.print(s);
-xs:= mosaic.thetasubselect(x,c,50,"!=");
-io.print(xs);
-
diff --git a/monetdb5/modules/mal/Tests/mosaic_rle_subselect.stable.out 
b/monetdb5/modules/mal/Tests/mosaic_rle_subselect.stable.out
--- a/monetdb5/modules/mal/Tests/mosaic_rle_subselect.stable.out
+++ b/monetdb5/modules/mal/Tests/mosaic_rle_subselect.stable.out
@@ -60,34 +60,6 @@ function user.main():void;
     io.print(s);
     xs := mosaic.subselect(x,nil:int,nil:int,false,false,true);
     io.print(xs);
-    c := bat.new(:oid,:oid);
-    bat.append(c,0@0);
-    bat.append(c,3@0);
-    io.print(c);
-    s := algebra.thetasubselect(b,c,50,"<");
-    io.print(s);
-    xs := mosaic.thetasubselect(x,c,50,"<");
-    io.print(xs);
-    s := algebra.thetasubselect(b,c,50,"<=");
-    io.print(s);
-    xs := mosaic.thetasubselect(x,c,50,"<=");
-    io.print(xs);
-    s := algebra.thetasubselect(b,c,50,">");
-    io.print(s);
-    xs := mosaic.thetasubselect(x,c,50,">");
-    io.print(xs);
-    s := algebra.thetasubselect(b,c,50,">=");
-    io.print(s);
-    xs := mosaic.thetasubselect(x,c,50,">=");
-    io.print(xs);
-    s := algebra.thetasubselect(b,c,50,"==");
-    io.print(s);
-    xs := mosaic.thetasubselect(x,c,50,"==");
-    io.print(xs);
-    s := algebra.thetasubselect(b,c,50,"!=");
-    io.print(s);
-    xs := mosaic.thetasubselect(x,c,50,"!=");
-    io.print(xs);
 end main;
 #--------------------------#
 # h    t  # name
@@ -286,72 +258,6 @@ end main;
 # h    t  # name
 # void oid  # type
 #--------------------------#
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 0@0  ]
-[ 1@0, 3@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 3@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 3@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 0@0  ]
-[ 1@0, 3@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 0@0  ]
-[ 1@0, 3@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 0@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 0@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 0@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 0@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 3@0  ]
-#--------------------------#
-# h    t  # name
-# void oid  # type
-#--------------------------#
-[ 0@0, 3@0  ]
 
 # 15:21:02 >  
 # 15:21:02 >  "Done."
diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -68,27 +68,28 @@ MOSdumpInternal(Client cntxt, BAT *b){
        if( task == NULL)
                return;
        MOSinit(task,b);
-       while(task->blk){
+       MOSinitializeScan(cntxt,task,0,task->hdr->top);
+       while(task->start< task->stop){
                switch(MOStag(task->blk)){
                case MOSAIC_NONE:
                        MOSdump_none(cntxt,task);
-                       MOSskip_none(task);
+                       MOSadvance_none(cntxt,task);
                        break;
                case MOSAIC_RLE:
                        MOSdump_rle(cntxt,task);
-                       MOSskip_rle(task);
+                       MOSadvance_rle(cntxt,task);
                        break;
                case MOSAIC_DICT:
                        MOSdump_dict(cntxt,task);
-                       MOSskip_dict(task);
+                       MOSadvance_dict(cntxt,task);
                        break;
                case MOSAIC_DELTA:
                        MOSdump_delta(cntxt,task);
-                       MOSskip_delta(task);
+                       MOSadvance_delta(cntxt,task);
                        break;
                case MOSAIC_ZONE:
                        MOSdump_zone(cntxt,task);
-                       MOSskip_zone(task);
+                       MOSadvance_zone(cntxt,task);
                }
        }
 }
@@ -168,7 +169,7 @@ MOScompressInternal(Client cntxt, int *r
        str msg = MAL_SUCCEED;
        MOStask task;
        int cand;
-       lng percentage=0, perc;
+       float factor= 1.0, fac= 1.0;
        int filter[MOSAIC_METHODS];
        
        if( properties && !strstr(properties,"compressed"))
@@ -255,8 +256,8 @@ MOScompressInternal(Client cntxt, int *r
                // default is to extend the non-compressed block
                //mnstr_printf(cntxt->fdout,"#elements "BUNFMT"\n",task->elm);
                cand = MOSAIC_NONE;
-               perc = 100;
-               percentage = 100;
+               fac = 1.0;
+               factor = 1.0;
 
                // cutoff the filters, especially dictionary tests are expensive
                if( cutoff && cutoff > task->elm){
@@ -267,38 +268,38 @@ MOScompressInternal(Client cntxt, int *r
                
                // select candidate amongst those
                if ( filter[MOSAIC_RLE]){
-                       perc = MOSestimate_rle(cntxt,task);
-                       if (perc >= 0 &&  perc < percentage){
+                       fac = MOSestimate_rle(cntxt,task);
+                       if (fac > factor){
                                cand = MOSAIC_RLE;
-                               percentage = perc;
+                               factor = fac;
                        }
                }
                if ( filter[MOSAIC_DICT]){
-                       perc = MOSestimate_dict(cntxt,task);
-                       if (perc >= 0 && perc <= percentage){
+                       fac = MOSestimate_dict(cntxt,task);
+                       if (fac > factor){
                                cand = MOSAIC_DICT;
-                               percentage = perc;
+                               factor = fac;
                        }
                }
-               if (0 && filter[MOSAIC_ZONE]){
-                       perc = MOSestimate_zone(cntxt,task);
-                       if (perc >= 0 && perc < percentage){
+               if ( filter[MOSAIC_ZONE]){
+                       fac = MOSestimate_zone(cntxt,task);
+                       if (fac > factor){
                                cand = MOSAIC_ZONE;
-                               percentage = perc;
+                               factor = fac;
                        }
                }
                if ( filter[MOSAIC_DELTA]){
-                       perc = MOSestimate_delta(cntxt,task);
-                       if ( perc >=0 &&  perc < percentage){
+                       fac = MOSestimate_delta(cntxt,task);
+                       if ( fac > factor ){
                                cand = MOSAIC_DELTA;
-                               percentage = perc;
+                               factor = fac;
                        }
                }
                if ( filter[MOSAIC_LINEAR]){
-                       perc = MOSestimate_linear(cntxt,task);
-                       if ( perc >=0 &&  perc < percentage){
+                       fac = MOSestimate_linear(cntxt,task);
+                       if ( fac >factor){
                                cand = MOSAIC_LINEAR;
-                               percentage = perc;
+                               factor = fac;
                        }
                }
 
@@ -312,9 +313,9 @@ MOScompressInternal(Client cntxt, int *r
                        if( (MOStag(task->blk) == MOSAIC_NONE || 
MOStag(task->blk) == MOSAIC_ZONE) && MOScnt(task->blk) ){
                                MOSupdateHeader(cntxt,task);
                                if( MOStag(task->blk) == MOSAIC_NONE)
-                                       MOSskip_none(task);
+                                       MOSskip_none(cntxt,task);
                                else
-                                       MOSskip_zone(task);
+                                       MOSskip_zone(cntxt,task);
                                // always start with an EOL block
                                task->dst = ((char*) task->blk)+ MosaicBlkSize;
                                *task->blk = MOSeol;
@@ -327,7 +328,7 @@ MOScompressInternal(Client cntxt, int *r
                        MOSupdateHeader(cntxt,task);
                        //prepare new block header
                        task->elm -= MOScnt(task->blk);
-                       MOSadvance_dict(task);
+                       MOSadvance_dict(cntxt,task);
                        *task->blk = MOSeol;
                        task->dst = ((char*) task->blk)+ MosaicBlkSize;
                        break;
@@ -336,7 +337,7 @@ MOScompressInternal(Client cntxt, int *r
                        MOSupdateHeader(cntxt,task);
                        //prepare new block header
                        task->elm -= MOScnt(task->blk);
-                       MOSadvance_delta(task);
+                       MOSadvance_delta(cntxt,task);
                        *task->blk = MOSeol;
                        task->dst = ((char*) task->blk)+ MosaicBlkSize;
                        break;
@@ -345,7 +346,7 @@ MOScompressInternal(Client cntxt, int *r
                        MOSupdateHeader(cntxt,task);
                        //prepare new block header
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to