Changeset: 1f84c72afc79 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f84c72afc79
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        monetdb5/modules/mal/tablet.c
        monetdb5/optimizer/opt_mergetable.c
Branch: default
Log Message:

merged with jul2015


diffs (truncated from 978 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -40174,11 +40174,11 @@ pattern profiler.stop():void
 address CMDstopProfiler;
 comment Stop performance tracing
 
-command profiler.stethoscope(b:int):void 
+pattern profiler.stethoscope(b:int):void 
 address CMDstethoscope;
 comment Start stethoscope profiling with heart beat
 
-command profiler.tomograph(b:int):void 
+pattern profiler.tomograph(b:int):void 
 address CMDtomograph;
 comment Start tomograph profiler with heart beat
 
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -51109,11 +51109,11 @@ pattern profiler.stop():void
 address CMDstopProfiler;
 comment Stop performance tracing
 
-command profiler.stethoscope(b:int):void 
+pattern profiler.stethoscope(b:int):void 
 address CMDstethoscope;
 comment Start stethoscope profiling with heart beat
 
-command profiler.tomograph(b:int):void 
+pattern profiler.tomograph(b:int):void 
 address CMDtomograph;
 comment Start tomograph profiler with heart beat
 
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -896,6 +896,7 @@ SQLinsert_val(READERtask *task, int col,
                        BUNappend(task->cntxt->error_msg, buf, FALSE);
                        BUNappend(task->cntxt->error_input, err, FALSE);
                        snprintf(buf, BUFSIZ, "line " LLFMT " field %d '%s' 
expected in '%s'", row, col, fmt->type, s);
+                       buf[BUFSIZ-1]=0;
                        if (task->as->error == NULL && (task->as->error = 
GDKstrdup(buf)) == NULL)
                                task->as->error = M5OutOfMemory;
                        task->rowerror[idx]++;
diff --git a/monetdb5/optimizer/opt_mergetable.c 
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -30,6 +30,12 @@ typedef struct mat {
        int pushed;              
 } mat_t;
 
+typedef struct matlist {
+       mat_t *v;
+       int top;
+       int size;
+} matlist_t;
+
 static mat_type_t
 mat_type( mat_t *mat, int n) 
 {
@@ -40,20 +46,20 @@ mat_type( mat_t *mat, int n)
 }
 
 static int
-is_a_mat(int idx, mat_t *mat, int top){
+is_a_mat(int idx, matlist_t *ml){
        int i;
-       for(i =0; i<top; i++)
-               if (mat[i].mv == idx) 
+       for(i =0; i<ml->top; i++)
+               if (ml->v[i].mv == idx) 
                        return i;
        return -1;
 }
 
 static int
-nr_of_mats(InstrPtr p, mat_t *mat, int mtop)
+nr_of_mats(InstrPtr p, matlist_t *ml)
 {
        int j,cnt=0;
        for(j=p->retc; j<p->argc; j++)
-               if (is_a_mat(getArg(p,j), mat, mtop) >= 0) 
+               if (is_a_mat(getArg(p,j), ml) >= 0) 
                        cnt++;
        return cnt;
 }
@@ -68,35 +74,41 @@ nr_of_bats(MalBlkPtr mb, InstrPtr p)
        return cnt;
 }
 
-inline static int
-mat_add(mat_t *mat, int mtop, InstrPtr q, mat_type_t type, char *func) 
+/* some mat's have intermediates (with intermediate result variables), therefor
+ * we pass the old output mat variable */
+inline static void
+mat_add_var(matlist_t *ml, InstrPtr q, InstrPtr p, int var, mat_type_t type, 
int inputmat, int parentmat) 
 {
-       mat[mtop].mi = q;
-       mat[mtop].org = NULL;
-       mat[mtop].mv = getArg(q,0);
-       mat[mtop].type = type;
-       mat[mtop].pm = -1;
-       mat[mtop].packed = 0;
-       mat[mtop].pushed = 0;
-       (void)func;
-       //printf (" mtop %d %s\n", mtop, func);
-       return mtop+1;
+       mat_t *dst = &ml->v[ml->top];
+       if (ml->top == ml->size) {
+               int s = ml->size * 2;
+               mat_t *v = (mat_t*)GDKzalloc(s * sizeof(mat_t));
+               if (!v)
+                       return;    /* FIXME: error checking */
+               memcpy(v, ml->v, ml->top * sizeof(mat_t));
+               GDKfree(ml->v);
+               ml->size = s;
+               ml->v = v;
+               dst = &ml->v[ml->top];
+       }
+       dst->mi = q;
+       dst->org = p;
+       dst->mv = var;
+       dst->type = type;
+       dst->im = inputmat;
+       dst->pm = parentmat;
+       dst->packed = 0;
+       dst->pushed = 1;
+       ++ml->top;
 }
 
-/* some mat's have intermediates (with intermediate result variables), therefor
- * we pass the old output mat variable */
-inline static int
-mat_add_var(mat_t *mat, int mtop, InstrPtr q, InstrPtr p, int var, mat_type_t 
type, int inputmat, int parentmat) 
+inline static void
+mat_add(matlist_t *ml, InstrPtr q, mat_type_t type, char *func) 
 {
-       mat[mtop].mi = q;
-       mat[mtop].org = p;
-       mat[mtop].mv = var;
-       mat[mtop].type = type;
-       mat[mtop].im = inputmat;
-       mat[mtop].pm = parentmat;
-       mat[mtop].packed = 0;
-       mat[mtop].pushed = 1;
-       return mtop+1;
+       mat_add_var(ml, q, NULL, getArg(q,0), type, -1, -1);
+       ml->v[ml->top-1].pushed = 0;
+       (void)func;
+       //printf (" ml.top %d %s\n", ml.top, func);
 }
 
 static void 
@@ -279,16 +291,17 @@ mat_delta(MalBlkPtr mb, InstrPtr p, mat_
 
 
 static InstrPtr
-mat_apply1(MalBlkPtr mb, InstrPtr p, mat_t *mat, int mtop, int m, int var)
+mat_apply1(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int var)
 {
        int tpe, k, is_select = isSubSelect(p), is_mirror = (getFunctionId(p) 
== mirrorRef);
        int is_identity = (getFunctionId(p) == identityRef && getModuleId(p) == 
batcalcRef);
        int ident_var = 0, is_assign = (getFunctionId(p) == NULL), n = 0;
        InstrPtr r = NULL, q;
+       mat_t *mat = ml->v;
 
        /* Find the mat we overwrite */
        if (is_assign) {
-               n = is_a_mat(getArg(p, 0), mat, mtop);
+               n = is_a_mat(getArg(p, 0), ml);
                is_assign = (n >= 0);
        }
 
@@ -399,11 +412,12 @@ mat_apply3(MalBlkPtr mb, InstrPtr p, mat
 }
 
 
-static int
-mat_setop(MalBlkPtr mb, InstrPtr p, mat_t *mat, int mtop, int m, int n)
+static void
+mat_setop(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int n)
 {
        int tpe = getArgType(mb,p, 0), k, j;
        InstrPtr r = newInstruction(mb, ASSIGNsymbol);
+       mat_t *mat = ml->v;
 
        setModuleId(r,matRef);
        setFunctionId(r,packRef);
@@ -451,15 +465,15 @@ mat_setop(MalBlkPtr mb, InstrPtr p, mat_
                }
        }
 
-       mtop = mat_add(mat, mtop, r, mat_none, getFunctionId(p));
-       return mtop;
+       mat_add(ml, r, mat_none, getFunctionId(p));
 }
 
-static int
-mat_leftfetchjoin(MalBlkPtr mb, InstrPtr p, mat_t *mat, int mtop, int m, int n)
+static void
+mat_leftfetchjoin(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int n)
 {
        int tpe = getArgType(mb,p, 0), k, j;
        InstrPtr r = newInstruction(mb, ASSIGNsymbol);
+       mat_t *mat = ml->v;
 
        setModuleId(r,matRef);
        setFunctionId(r,packRef);
@@ -501,16 +515,16 @@ mat_leftfetchjoin(MalBlkPtr mb, InstrPtr
                }
        }
 
-       mtop = mat_add(mat, mtop, r, mat_none, getFunctionId(p));
-       return mtop;
+       mat_add(ml, r, mat_none, getFunctionId(p));
 }
 
-static int
-mat_join2(MalBlkPtr mb, InstrPtr p, mat_t *mat, int mtop, int m, int n)
+static void
+mat_join2(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int n)
 {
        int tpe = getArgType(mb,p, 0), j,k, nr = 1;
        InstrPtr l = newInstruction(mb, ASSIGNsymbol);
        InstrPtr r = newInstruction(mb, ASSIGNsymbol);
+       mat_t *mat = ml->v;
 
        setModuleId(l,matRef);
        setFunctionId(l,packRef);
@@ -564,17 +578,17 @@ mat_join2(MalBlkPtr mb, InstrPtr p, mat_
                        r = pushArgument(mb, r, getArg(q,1));
                }
        }
-       mtop = mat_add(mat, mtop, l, mat_none, getFunctionId(p));
-       mtop = mat_add(mat, mtop, r, mat_none, getFunctionId(p));
-       return mtop;
+       mat_add(ml, l, mat_none, getFunctionId(p));
+       mat_add(ml, r, mat_none, getFunctionId(p));
 }
 
-static int
-mat_join3(MalBlkPtr mb, InstrPtr p, mat_t *mat, int mtop, int m, int n, int o)
+static void
+mat_join3(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int n, int o)
 {
        int tpe = getArgType(mb,p, 0), j,k, nr = 1;
        InstrPtr l = newInstruction(mb, ASSIGNsymbol);
        InstrPtr r = newInstruction(mb, ASSIGNsymbol);
+       mat_t *mat = ml->v;
 
        setModuleId(l,matRef);
        setFunctionId(l,packRef);
@@ -632,9 +646,8 @@ mat_join3(MalBlkPtr mb, InstrPtr p, mat_
                        r = pushArgument(mb, r, getArg(q,1));
                }
        }
-       mtop = mat_add(mat, mtop, l, mat_none, getFunctionId(p));
-       mtop = mat_add(mat, mtop, r, mat_none, getFunctionId(p));
-       return mtop;
+       mat_add(ml, l, mat_none, getFunctionId(p));
+       mat_add(ml, r, mat_none, getFunctionId(p));
 }
 
 
@@ -799,12 +812,12 @@ walk_n_back(mat_t *mat, int g, int cnt)
 }
 
 static int
-group_by_ext(mat_t *mat, int mtop, int g)
+group_by_ext(matlist_t *ml, int g)
 {
        int i;
 
-       for(i=g; i< mtop; i++){ 
-               if (mat[i].pm == g)
+       for(i=g; i< ml->top; i++){ 
+               if (ml->v[i].pm == g)
                        return i;
        }
        return 0;
@@ -814,12 +827,13 @@ group_by_ext(mat_t *mat, int mtop, int g
  * gext.leftfetchjoin(mat.pack(per partition ext.leftfetchjoins(x))) 
  */
 
-static int
-mat_group_project(MalBlkPtr mb, InstrPtr p, mat_t *mat, int mtop, int e, int a)
+static void
+mat_group_project(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int e, int a)
 {
        int tp = getArgType(mb,p,0), k;
        int tail = getColumnType(tp);
        InstrPtr ai1 = newInstruction(mb, ASSIGNsymbol), r;
+       mat_t *mat = ml->v;
 
        setModuleId(ai1,matRef);
        setFunctionId(ai1,packRef);
@@ -844,8 +858,7 @@ mat_group_project(MalBlkPtr mb, InstrPtr
        getArg(r,2) = getArg(ai1,0);
        pushInstruction(mb,r);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to