Changeset: 6abaee90727b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6abaee90727b
Added Files:
        monetdb5/scheduler/Tests/8RunsJoinCorrectness.mal
Modified Files:
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/scheduler/mut_transforms.c
Branch: mutation
Log Message:

added bat.info code and test script for join correctness


diffs (211 lines):

diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -109,6 +109,7 @@ str insertRef;
 str intRef;
 str ioRef;
 str iteratorRef;
+str infoRef;
 str joinRef;
 str joinPathRef;
 str bandjoinRef;
@@ -370,6 +371,7 @@ void optimizerInit(void){
                intRef = putName("int",3);
                ioRef = putName("io",2);
                iteratorRef = putName("iterator",8);
+               infoRef = putName("info",4);
                joinRef = putName("join",4);
                joinPathRef = putName("joinPath",8);
                bandjoinRef = putName("bandjoin",8);
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -108,6 +108,7 @@ opt_export  str insertRef;
 opt_export  str intRef;
 opt_export  str ioRef;
 opt_export  str iteratorRef;
+opt_export str infoRef;
 opt_export  str joinRef;
 opt_export  str joinPathRef;
 opt_export  str bandjoinRef;
diff --git a/monetdb5/scheduler/Tests/8RunsJoinCorrectness.mal 
b/monetdb5/scheduler/Tests/8RunsJoinCorrectness.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/scheduler/Tests/8RunsJoinCorrectness.mal
@@ -0,0 +1,70 @@
+function initializeFirst{unsafe}():bat[:oid,:lng];
+        b:= bat.new(:oid,:lng);
+        k := 0:lng;
+        barrier i:= 0:lng;
+                k:= 1:lng;
+                l:= calc.lng(k);
+                bat.append(b,l);
+                redo i:= iterator.next(1:lng,16:lng);
+        exit i;
+#       io.print(b);
+
+        return b;
+end initializeFirst;
+
+function initializeNext{unsafe}():bat[:oid,:lng];
+        b:= bat.new(:oid,:lng);
+        k := 0:lng;
+        barrier i:= 0:lng;
+                k:= k+1;
+                l:= calc.lng(k);
+                bat.append(b,l);
+                redo i:= iterator.next(1:lng,4:lng);
+        exit i;
+#       io.print(b);
+        return b;
+end initializeNext;
+
+function query(run:int, a:bat[:oid,:lng], b:bat[:oid,:lng]);
+       
+       profiler.activate("ticks");
+        profiler.activate("thread");
+        profiler.activate("stmt");
+        profiler.activate("time");
+        profiler.setAll();
+        profiler.start();
+
+        t0:= alarm.usec();
+barrier z:= language.dataflow();
+        (s1,s2) := algebra.join(a,b);
+exit z;
+        t1:= alarm.usec();
+        t2 := t1-t0;
+        io.printf("#run %d %d\n",run,t2);
+        stmt:= profiler.getTrace("stmt");
+        ticks:= profiler.getTrace("ticks");
+        thread:= profiler.getTrace("thread");
+        time1:= profiler.getTrace("time");
+       io.print(time1,thread,ticks,stmt);
+
+end query;
+
+optimizer.multicore("user","query");
+function testrun();
+
+        a:= initializeFirst();
+        b:= initializeNext();
+        user.query(0,a,b);
+        user.query(1,a,b);
+        user.query(2,a,b);
+        user.query(3,a,b);
+        user.query(4,a,b);
+        user.query(5,a,b);
+#        user.query(6,a,b);
+#        user.query(7,a,b);
+#        user.query(8,a,b);
+#        user.query(9,a,b);
+#        user.query(10,a,b);
+
+end testrun;
+testrun();
diff --git a/monetdb5/scheduler/mut_transforms.c 
b/monetdb5/scheduler/mut_transforms.c
--- a/monetdb5/scheduler/mut_transforms.c
+++ b/monetdb5/scheduler/mut_transforms.c
@@ -36,7 +36,7 @@
 
 void 
 mutationJoin(Client cntxt, Mutant m){
-    int pc = m->target, i, j, k, limit, b1,b2, v1,v2, z1,z2;
+    int pc = m->target, i, j, k, limit, b1,b2, v1,v2, z1,z2, g1, h1;
     InstrPtr p=0, *old= m->src->stmt, q;
        int matpc = 0, profiler;
 
@@ -66,9 +66,21 @@ mutationJoin(Client cntxt, Mutant m){
                                continue;
                        }
                
-                       // make the previous print statement associated with 
this algebra.join operator a no-op 
-                                               
+                       // make the previous io.print statement associated with 
this algebra.join operator a no-op      
+                       if (getModuleId(old[i+1]) == ioRef && 
getFunctionId(old[i+1]) == printRef)
+                       {                                                       
                                                
+                               old[i+1]->token=NOOPsymbol;
 
+                               if (getModuleId(old[i+2]) == batRef && 
getFunctionId(old[i+2]) == infoRef)
+                               {       
+                                       old[i+2]->token = NOOPsymbol;           
                
+                                       
+                                       if (getModuleId(old[i+3]) == ioRef && 
getFunctionId(old[i+3]) == printRef)
+                                       {
+                                               old[i+3]->token = NOOPsymbol;   
                        
+                                       }
+                               }
+                       }
 
                        profiler = m->src->profiler[i].trace;
                        q= newStmt(m->src, batRef, partitionRef);
@@ -112,7 +124,18 @@ mutationJoin(Client cntxt, Mutant m){
                        q = pushArgument(m->src,q, b1);
                        // inherit profiling
                        m->src->profiler[m->src->stop-1].trace = profiler;
-                       
+
+                     q = newStmt(m->src, batRef, infoRef);
+                     q = pushArgument(m->src,q, b1);     
+                     g1 = getArg(q,0) = newTmpVariable(m->src, 
newBatType(TYPE_oid, TYPE_str));
+                     h1 = getArg(q,1) = newTmpVariable(m->src, 
newBatType(TYPE_oid, TYPE_str));
+                     m->src->profiler[m->src->stop-1].trace = profiler;
+
+                     q = newStmt(m->src, ioRef, printRef);
+                     q = pushArgument(m->src,q, g1);     
+                     q = pushArgument(m->src,q, h1);     
+                     m->src->profiler[m->src->stop-1].trace = profiler;
+
                        q= newStmt(m->src, languageRef, passRef);
                        q = pushArgument(m->src,q,b1);
                        // inherit profiling
@@ -126,14 +149,23 @@ mutationJoin(Client cntxt, Mutant m){
                        // inherit profiling
                        m->src->profiler[m->src->stop-1].trace = profiler;
 
-                       // to avoid the case of a double push of ioRef and 
printRef on an already present algebra.join
-//                     if (getModuleId(old[i+1]) != ioRef && 
getFunctionId(old[i+1]) != printRef)
-//                     {
-                               q= newStmt(m->src, ioRef, printRef);
-                               q = pushArgument(m->src,q, b2);
-                               // inherit profiling
-                               m->src->profiler[m->src->stop-1].trace = 
profiler;
-//                     }
+                       q= newStmt(m->src, ioRef, printRef);
+                       q = pushArgument(m->src,q, b2);
+                       // inherit profiling
+                       m->src->profiler[m->src->stop-1].trace = profiler;
+
+                       // print bat.info for tracing problem in bat corruption
+/*                   q = newStmt(m->src, batRef, infoRef);
+                     q = pushArgument(m->src,q, b2);     
+                     g1 = getArg(q,0) = newTmpVariable(m->src, 
newBatType(TYPE_oid, TYPE_str));
+                     h1 = getArg(q,1) = newTmpVariable(m->src, 
newBatType(TYPE_oid, TYPE_str));
+                     m->src->profiler[m->src->stop-1].trace = profiler;
+
+                     q = newStmt(m->src, ioRef, printRef);
+                     q = pushArgument(m->src,q, g1);     
+                     q = pushArgument(m->src,q, h1);     
+                     m->src->profiler[m->src->stop-1].trace = profiler;
+*/
 
                        q= newStmt(m->src, languageRef, passRef);
                        q = pushArgument(m->src,q,b2);
@@ -192,6 +224,17 @@ mutationJoin(Client cntxt, Mutant m){
                                              q = newStmt(m->src, ioRef, 
printRef);
                                              q = pushArgument(m->src,q, 
getArg(p, p->retc));     
                                              
m->src->profiler[m->src->stop-1].trace = profiler;
+                                               
+                                             q = newStmt(m->src, batRef, 
infoRef);
+                                             q = pushArgument(m->src,q, 
getArg(p, p->retc));     
+                                             g1 = getArg(q,0) = 
newTmpVariable(m->src, newBatType(TYPE_oid, TYPE_str));
+                                             h1 = getArg(q,1) = 
newTmpVariable(m->src, newBatType(TYPE_oid, TYPE_str));
+                                             
m->src->profiler[m->src->stop-1].trace = profiler;
+
+                                             q = newStmt(m->src, ioRef, 
printRef);
+                                             q = pushArgument(m->src,q, g1);   
  
+                                             q = pushArgument(m->src,q, h1);   
  
+                                             
m->src->profiler[m->src->stop-1].trace = profiler;
                                        }               
                                }
                        }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to