Changeset: f0aef7fce40e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f0aef7fce40e
Modified Files:
        monetdb5/modules/mal/bpm.mx
        monetdb5/optimizer/opt_mitosis.mx
        sql/backends/monet5/sql.mx
Branch: default
Log Message:

Sofar mitoses passed the boundaries of the partitions.
Now it just passes the number of partitions and the partition number.
The later is more robust against growing columns.


diffs (121 lines):

diff --git a/monetdb5/modules/mal/bpm.mx b/monetdb5/modules/mal/bpm.mx
--- a/monetdb5/modules/mal/bpm.mx
+++ b/monetdb5/modules/mal/bpm.mx
@@ -19,7 +19,7 @@
 
 @f bpm
 @v 0.5
-@a M.L.Kersten, M. Ivanova
+@a M.L.Kersten, M. Ivanova, N.J. Nes
 @+ BAT Partition Manager
 In real-life database applications the BATs tend to grow beyond
 the memory size. This leads to a heavy IO dominated behavior,
diff --git a/monetdb5/optimizer/opt_mitosis.mx 
b/monetdb5/optimizer/opt_mitosis.mx
--- a/monetdb5/optimizer/opt_mitosis.mx
+++ b/monetdb5/optimizer/opt_mitosis.mx
@@ -228,14 +228,16 @@
 
                for(j=0; j < pieces; j++){
                        q= copyInstruction(p);
-                       q= pushOid(mb,q,low.value.val.oval);
+                       q= pushInt(mb,q,j);
+                       q= pushInt(mb,q,pieces);
+                       //q= pushOid(mb,q,low.value.val.oval);
                        if (j+1 < pieces) {
                                hgh.value.val.oval= low.value.val.oval+slice;
                        } else {
                                assert(rowcnt <= (wrd) BUN_MAX);
                                hgh.value.val.oval= (BUN) rowcnt;
                        }
-                       q = pushOid(mb,q,hgh.value.val.oval);
+                       //q = pushOid(mb,q,hgh.value.val.oval);
 
                        k= getArg(q,0)= newTmpVariable(mb,tpe);
                        setVarUDFtype(mb,k);
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -169,6 +169,13 @@
        1 - inserts
        2 - updates";
 
+pattern bind_idxbat(mvc:ptr, schema:str, table:str, index:str, access:int, 
part_nr:int, nr_parts:int):bat[:oid,:any_1]
+address mvc_bind_idxbat_wrap
+comment "Bind the 'schema.table.index' BAT with access kind:
+       0 - base table
+       1 - inserts
+       2 - updates";
+
 pattern bind(mvc:ptr, schema:str, table:str, column:str, access:int 
):bat[:oid,:any_1]
 address mvc_bind_wrap
 comment "Bind the 'schema.table.column' BAT with access kind:
@@ -183,6 +190,13 @@
        1 - inserts
        2 - updates";
 
+pattern bind(mvc:ptr, schema:str, table:str, column:str, access:int, 
part_nr:int, nr_parts:int ):bat[:oid,:any_1]
+address mvc_bind_wrap
+comment "Bind the 'schema.table.column' BAT partition with access kind:
+       0 - base table
+       1 - inserts
+       2 - updates";
+
 command bind_dbat(clientid:int, schema:str, table:str, access:int, 
oldversion:lng, version:lng):bat[:oid,:oid]
 address mvc_diff_dbat_wrap
 comment "Bind to 'schema.table' BAT with deleted objecs
@@ -2608,7 +2622,7 @@
        (void) cntxt;
        b = mvc_bind(m, *sname, *tname, *cname, *access);
        if (b) {
-               if ( pci->argc == 8){
+               if ( pci->argc == 8 && getArgType(mb,pci,6) == TYPE_oid){
                        /* partitioned access */
                        lval = *(oid *)getArgReference(stk, pci, 6);
                        hval = *(oid *)getArgReference(stk, pci, 7);
@@ -2617,6 +2631,18 @@
                        BBPkeepref( *bid = bn->batCacheid);
                        BBPreleaseref(b->batCacheid);
                        return MAL_SUCCEED;
+               } else if ( pci->argc == 8 && getArgType(mb,pci,6) == TYPE_int){
+                       BUN cnt = BATcount(b), psz;
+                       /* partitioned access */
+                       int part_nr = *(int *)getArgReference(stk, pci, 6);
+                       int nr_parts = *(int *)getArgReference(stk, pci, 7);
+
+                       psz = cnt?(cnt/nr_parts):0;
+                       bn =  BATslice(b, part_nr*psz, 
(part_nr+1==nr_parts)?BATcount(b):((part_nr+1)*psz));
+                       BATseqbase(bn, part_nr*psz);
+                       BBPkeepref( *bid = bn->batCacheid);
+                       BBPreleaseref(b->batCacheid);
+                       return MAL_SUCCEED;
                }
                BBPkeepref( *bid = b->batCacheid);
                return MAL_SUCCEED;
@@ -2642,7 +2668,7 @@
        (void) cntxt;
        b = mvc_bind_idxbat(m, *sname, *tname, *iname, *access);
        if (b) {
-               if ( pci->argc == 8){
+               if ( pci->argc == 8 && getArgType(mb,pci,6) == TYPE_oid){
                        /* partitioned access */
                        lval = *(oid *)getArgReference(stk, pci, 6);
                        hval = *(oid *)getArgReference(stk, pci, 7);
@@ -2651,6 +2677,18 @@
                        BBPkeepref( *bid = bn->batCacheid);
                        BBPreleaseref(b->batCacheid);
                        return MAL_SUCCEED;
+               } else if ( pci->argc == 8 && getArgType(mb,pci,6) == TYPE_int){
+                       BUN cnt = BATcount(b), psz;
+                       /* partitioned access */
+                       int part_nr = *(int *)getArgReference(stk, pci, 6);
+                       int nr_parts = *(int *)getArgReference(stk, pci, 7);
+
+                       psz = cnt?(cnt/nr_parts):0;
+                       bn =  BATslice(b, part_nr*psz, 
(part_nr+1==nr_parts)?BATcount(b):((part_nr+1)*psz));
+                       BATseqbase(bn, part_nr*psz);
+                       BBPkeepref( *bid = bn->batCacheid);
+                       BBPreleaseref(b->batCacheid);
+                       return MAL_SUCCEED;
                }
                BBPkeepref( *bid = b->batCacheid);
                return MAL_SUCCEED;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to