Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28374/src/backends/monet5

Modified Files:
        sql_bpm.mx sql_gencode.mx sql_optimizer.mx 
Log Message:
make sql_bpm.mx compile again (mostly done the ughly way using comments, needs
cleanup when romulo returns)

removed access optimiser as its no longer needed

cleanup of sql__optimzer needed for the changes of the bpm storage layer


U sql_bpm.mx
Index: sql_bpm.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_bpm.mx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- sql_bpm.mx  2 Aug 2008 06:42:37 -0000       1.15
+++ sql_bpm.mx  22 Aug 2008 09:53:53 -0000      1.16
@@ -88,8 +88,6 @@
        if (p->nr <= part) {
                return NULL;
        } else {
-               if (access == RD_INS)
-                       part += p->ins;
                if (access == RD_UPD){
                        assert(p->parts[part].ubid);
                        return temp_descriptor(p->parts[part].ubid);
@@ -133,8 +131,6 @@
        if (p->nr <= part) {
                return NULL;
        } else {
-               if (access == RD_INS)
-                       part += p->ins;
                if (access == RD_UPD)
                        return temp_descriptor(p->parts[part].ubid);
                return temp_descriptor(p->parts[part].bid);
@@ -181,7 +177,6 @@
        str *sname = (str *)getArgReference(stk, pci, 1);
        str *tname = (str *)getArgReference(stk, pci, 2);
        str *cname = (str *)getArgReference(stk, pci, 3);
-       int *access = (int *)getArgReference(stk, pci, 4);
        int *parts = (int *)getArgReference(stk, pci, 5);
 
        (void)d;
@@ -197,12 +192,8 @@
                sql_idx *i = mvc_bind_idx(m, s, *cname);
                p = i->data;
        }
-       if (*access == RD_INS)
-               err = *parts != (p->nr-p->ins);
-       else
-               err = *parts != (p->ins);
-                   /* HACK ALERT */
-       if (!err || *access == RD_UPD) 
+       err = *parts != (p->nr);
+       if (!err) 
                return MAL_SUCCEED;
        throw(OPTIMIZER, "mal.assert", "parts changed");
 }
@@ -221,14 +212,14 @@
        if (isTempTable(t) || isView(t))
                return ;
        for (n=t->columns.set->h; n; n = n->next) {
-               sql_column *c = n->data;
-               if (c->data && !bpm_add_partition(c->data))
-                       return;
+               //sql_column *c = n->data;
+               //if (c->data && !bpm_add_partition(c->data))
+               //      return;
        }
        if (t->idxs.set) for (n=t->idxs.set->h; n; n = n->next) {
-               sql_idx *i = n->data;
-               if (i->data && !bpm_add_partition(i->data))
-                       return;
+               //sql_idx *i = n->data;
+               //if (i->data && !bpm_add_partition(i->data))
+               //      return;
        }
 }
 
@@ -264,22 +255,29 @@
 str
 send_part(sql_column *col, int part, BAT *b, str *conn)
 {
-       str tmp = NULL, ident = "romulo";
-       connection c;
-       sql_bpm *bpm;
+//     str tmp = NULL, ident = "romulo";
+//     connection c;
+//     sql_bpm *bpm = col->data;
        
+       (void)col;
+       (void)part;
+       (void)b;
+       (void)conn;
        /* lookup conn */
+/*
        if ((tmp= RMTfindconn(&c, *conn)) != MAL_SUCCEED)
                throw(SQL,"mat.send_part",tmp);
+*/
        
        /*send the fragment to the remote site*/ 
+/*
        if ((tmp = RMTinternalput(&ident, c->mconn, newBatType(b->H->type, 
b->T->type), &b->batCacheid)) != MAL_SUCCEED)
                throw(SQL,"mat.send_part",tmp);
        
+*/
        /*store the information about the fragment location*/
-       bpm = col->data;
-       if (!bpm_set_part_location(bpm, part, *conn, ident))
-               throw(SQL, "mat.send_part", "The storage of the remote location 
information failed!!");
+       //if (!bpm_set_part_location(bpm, part, *conn, ident))
+               //throw(SQL, "mat.send_part", "The storage of the remote 
location information failed!!");
        return MAL_SUCCEED;
 }
 
@@ -328,20 +326,24 @@
 str
 get_part(sql_column *col, int part, ptr b)
 {
-       str tmp, host, remote;
-       connection c;
-       sql_bpm *bpm;
-       bpm = col->data;
+//     str tmp, host = NULL, remote = NULL;
+//     connection c;
+//     sql_bpm *bpm = col->data;
        
-       bpm_get_part_location(bpm, part, &host, &remote);
+       (void)col;
+       //bpm_get_part_location(bpm, part, &host, &remote);
 
        /* lookup conn */
+/*
        if ((tmp = RMTfindconn(&c, host)) != MAL_SUCCEED)
                throw(SQL,"mat.get_part",tmp);
+*/
        
        /*get a fragment from the remote site */
+/*
        if ((tmp = RMTinternalget(c->mconn, remote, b)) != MAL_SUCCEED) 
                throw(SQL,"mat.get_part",tmp);
+*/
 
        if(!b)
                throw(SQL, "mat.get_part", sql_message("Get remote part %d for 
column %s", part, col->base.name));

U sql_gencode.mx
Index: sql_gencode.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_gencode.mx,v
retrieving revision 1.286
retrieving revision 1.287
diff -u -d -r1.286 -r1.287
--- sql_gencode.mx      20 Aug 2008 08:00:54 -0000      1.286
+++ sql_gencode.mx      22 Aug 2008 09:53:53 -0000      1.287
@@ -1147,9 +1147,14 @@
                                q = pushArgument(mb, q, e);
                                e = getDestVar(q);
 
+/*
                                q = newStmt1(mb, algebraRef, "semijoin");
                                q = pushArgument(mb, q, l);
                                q = pushArgument(mb, q, e);
+*/
+                               q = newStmt2(mb, algebraRef, joinRef);
+                               q = pushArgument(mb, q, e);
+                               q = pushArgument(mb, q, l);
                        } else {
                                int k;
 
@@ -1883,13 +1888,13 @@
        mvc *c = be->mvc;
        InstrPtr q;
 
-       (void) _dumpstmt(be, mb, s);
+       (void)_dumpstmt(be, mb, s);
        if (c->cache && (c->type == Q_SCHEMA || c->type == Q_TRANS)) {
                q = newStmt2(mb, sqlRef, exportOperationRef);
                q = pushStr(mb, q, ""); /* warning */
        }
        /* generate a dummy return assignment for functions */
-       if ( getArgType(mb,getInstrPtr(mb,0),0) != TYPE_void){
+       if (getArgType(mb,getInstrPtr(mb,0),0) != TYPE_void) {
                q = newAssignment(mb);
                getArg(q,0) = getArg(getInstrPtr(mb,0),0);
                q->barrier = RETURNsymbol;

U sql_optimizer.mx
Index: sql_optimizer.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_optimizer.mx,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -d -r1.192 -r1.193
--- sql_optimizer.mx    17 Aug 2008 11:11:25 -0000      1.192
+++ sql_optimizer.mx    22 Aug 2008 09:53:53 -0000      1.193
@@ -323,7 +323,7 @@
                        int not_null = 0;
                        lng rows = 1;
                        int mode = 0;
-                       int part = 0, off = 0;
+                       int part = 0;
                        int k = getArg(p,0);
                        sql_bpm *bpm = NULL;
                        sql_schema *s = mvc_bind_schema(m, sname);
@@ -339,20 +339,15 @@
                                mode = getVarConstant(mb, getArg(p,4)).val.ival;
                        }
 
+
                        if (s && f == bindidxRef) {
                                sql_idx *i = mvc_bind_idx(m, s, cname);
 
                                if (active_store_type == store_bpm && i->data) {
                                        bpm = i->data;
-                                       if (mode == RDONLY || mode == RD_UPD)
-                                               part = bpm->ins;
-                                       else if (mode == RD_INS) {
-                                               part = bpm->nr - bpm->ins;
-                                               off = bpm->ins;
-                                       }
+                                       part = bpm->nr;
                                }
-                               if (i->t->cnt && (mode == RDONLY || mode == 
RD_UPD))
-                                       rows = i->t->cnt;
+                               rows = store_funcs.count_idx(i);
                        } else if (s && f == bindRef) {
                                sql_table *t = mvc_bind_table(m, s, tname);
                                sql_column *c = mvc_bind_column(m, t, cname);
@@ -361,17 +356,12 @@
 
                                if (active_store_type == store_bpm && c->data) {
                                        bpm = c->data;
-                                       if (mode == RDONLY || mode == RD_UPD)
-                                               part = bpm->ins;
-                                       else if (mode == RD_INS) {
-                                               part = bpm->nr - bpm->ins;
-                                               off = bpm->ins;
-                                       }
+                                       part = bpm->nr;
                                }
-                               if (c->t->cnt && (mode == RDONLY || mode == 
RD_UPD))
-                                       rows = c->t->cnt;
+                               rows = store_funcs.count_col(c);
                        }       
-                       varSetProp(mb, k, rowsProp, op_eq, VALset(&vr, 
TYPE_lng, &rows));
+                       if (rows > 1 && mode != RD_INS)
+                               varSetProp(mb, k, rowsProp, op_eq, VALset(&vr, 
TYPE_lng, &rows));
                        if (not_null)
                                varSetProp(mb, k, notnilProp, op_eq, NULL);
                        if (0 && active_store_type == store_bpm && part && 
@@ -386,31 +376,23 @@
                                pushInstruction(mb,q);
                        }
                        if (part <= 1) {
+                               oid low = 0, high = low + rows;
                                pushInstruction(mb, p);
-                               if (bpm) {
-                                       oid low = 0, high = 1;
 
-                                       low = bpm->parts[off].hlow;
-                                       assert(low != (oid)-1);
-                                       high = bpm->parts[off].hhgh;
-                                       if (high == (oid)-1)
-                                               high = oid_nil;
-                                       varSetProp(mb, getArg(p,0), hlbProp, 
op_gte, VALset(&vr, TYPE_oid, &low));
-                                       varSetProp(mb, getArg(p,0), hubProp, 
op_lt, VALset(&vr, TYPE_oid, &high));
+                               if (mode == RD_INS) {
+                                       low = high;
+                                       high += BPM_SPLIT;
                                }
+                               varSetProp(mb, getArg(p,0), hlbProp, op_gte, 
VALset(&vr, TYPE_oid, &low));
+                               varSetProp(mb, getArg(p,0), hubProp, op_lt, 
VALset(&vr, TYPE_oid, &high));
                        } else {
                                int i, v = getArg(p,0);
                                int tpe = getVarType(mb, v);
                                int top = mb->stop;
+                               oid low = 0, high = 0;
 
                                for(i=0; i<part; i++){
-                                       oid low = 0, high = 1;
-
-                                       low = bpm->parts[off+i].hlow;
-                                       assert(low != (oid)-1);
-                                       high = bpm->parts[off+i].hhgh;
-                                       if (high == (oid)-1)
-                                               high = oid_nil;
+                                       high += BPM_SPLIT;
                                        q = newInstruction(mb, ASSIGNsymbol);
                                        setModuleId(q, matRef);
                                        setFunctionId(q, f);
@@ -422,6 +404,8 @@
 
                                        varSetProp(mb, getArg(q,0), hlbProp, 
op_gte, VALset(&vr, TYPE_oid, &low));
                                        varSetProp(mb, getArg(q,0), hubProp, 
op_lt, VALset(&vr, TYPE_oid, &high));
+
+                                       low = high;
                                }
                                q = newInstruction(mb, ASSIGNsymbol);
                                setModuleId(q,matRef);
@@ -455,7 +439,7 @@
        "emptySet,"
        /* "joinselect," */
        /* "accessmode," not needed after patches to BKCappend */
-       /* "mitosis,"*/
+       //"mitosis,"
        "aliases,"
        /* "crack," */
        /*"joinPath,"*/ 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to