Changeset: fb42e5938636 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb42e5938636
Added Files:
        sql/test/BugTracker-2013/Tests/segfault_in_aggregation.Bug-3225.data
        sql/test/BugTracker-2013/Tests/segfault_in_aggregation.Bug-3225.sql.in
        
sql/test/BugTracker-2013/Tests/segfault_in_aggregation.Bug-3225.stable.err
        
sql/test/BugTracker-2013/Tests/segfault_in_aggregation.Bug-3225.stable.out
Modified Files:
        clients/mapiclient/tomograph.c
        gdk/gdk_search.c
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/modules/kernel/aggr.c
        monetdb5/optimizer/Tests/tst4730.stable.out
        sql/backends/monet5/datacell/Tests/scenario01.sql
        sql/backends/monet5/datacell/Tests/scenario04.sql
        sql/server/rel_optimizer.c
        sql/test/BugTracker-2013/Tests/All
Branch: default
Log Message:

Merge with Feb2013 branch.


diffs (truncated from 17038 to 300 lines):

diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -56,7 +56,12 @@
 # endif
 #endif
 
-#define COUNTERSDEFAULT "ISTestmMrw"
+/* #define FOOTPRINT */
+#ifdef FOOTPRINT
+#define COUNTERSDEFAULT "ISTestMmrw"
+#else
+#define COUNTERSDEFAULT "ISTestmrw"
+#endif
 
 /* #define _DEBUG_TOMOGRAPH_*/
 
@@ -102,7 +107,9 @@ profileCounter[] = {
        /*  2  */ { 'D', "dot", "dot", 0 },
        /*  3  */ { 'F', "flow", "flow", 0 },
        /*  4  */ { 'x', "ping50", "ping", 0 },
+#ifdef FOOTPRINT
        /*  5  */ { 'M', "footprint", "footprint", 0 },
+#endif
        /*  6  */ { 0, 0, 0, 0 }
 };
 
@@ -835,6 +842,7 @@ static void showmemory(void)
                        if (box[i].memend < min)
                                min = box[i].memend;
 
+#ifdef FOOTPRINT
                        if (box[i].footstart > max)
                                max = box[i].footstart;
                        if (box[i].footend > max)
@@ -843,6 +851,7 @@ static void showmemory(void)
                                min = box[i].footstart;
                        if (box[i].footend < min && box[i].footend > 0)
                                min = box[i].footend;
+#endif
                }
        if (min == max) {
                min -= 1;
@@ -875,8 +884,12 @@ static void showmemory(void)
        mm = (mx - mn) / 50.0; /* 2% top & bottom margin */
        fprintf(gnudata, "set yrange [%f:%f]\n", mn - mm, mx + mm);
        fprintf(gnudata, "set ytics (\"%.*f\" %f, \"%.*f\" %f) nomirror\n", 
digits, min / scale, mn, digits, max / scale, mx);
+#ifdef FOOTPRINT
        fprintf(gnudata, "plot \"%s.dat\" using 1:2 notitle with dots linecolor 
rgb \"blue\", \\\n", (tracefile ? "scratch" : filename));
        fprintf(gnudata, " \"%s.dat\" using 1:3 notitle with dots linecolor rgb 
\"black\"\n", (tracefile ? "scratch" : filename));
+#else
+       fprintf(gnudata, "plot \"%s.dat\" using 1:2 notitle with dots linecolor 
rgb \"blue\"\n", (tracefile ? "scratch" : filename));
+#endif
        fprintf(gnudata, "unset yrange\n");
 }
 
@@ -1754,12 +1767,14 @@ static int parser(char *row)
        if (c == 0)
                return -8;
 
+#ifdef FOOTPRINT
        footprint = strtoll(c + 1, NULL, 10);
        if (debug && state < PING)
                fprintf(stderr, "%s\n", row);
        c = strchr(c + 1, (int) ',');
        if (c == 0 && state >= PING) 
                goto wrapup;
+#endif
 
        reads = strtoll(c + 1, NULL, 10);
        c = strchr(c + 1, (int) ',');
@@ -1796,7 +1811,9 @@ static int parser(char *row)
        if (fcn && strchr(fcn, (int) '('))
                *strchr(fcn, (int) '(') = 0;
 
+#ifdef FOOTPRINT
 wrapup:
+#endif
        update(state, thread, clkticks, ticks, memory, footprint, reads, 
writes, fcn, stmt);
 #else
        (void) row;
diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -157,6 +157,28 @@ HASHnew(Heap *hp, int tpe, BUN size, BUN
                }                                       \
        } while (0)
 
+/* collect HASH statistics for analysis */
+static void HASHcollisions(BAT *b, Hash *h)
+{
+       BUN p, *i, *j;
+       lng cnt, entries=0, max =0;
+       double total=0;
+       
+       if ( b == 0 || h == 0 )
+               return;
+       for (i = h->hash, j = i + h->mask; i <= j; i++) 
+       if ( *i != BUN_NONE){
+               entries++;
+               p = *i;
+               cnt = 0;
+               for ( ; p != BUN_NONE; p = h->link[p])
+                       cnt++;
+               if ( cnt > max ) max = cnt;
+               total += cnt;
+       }
+
+       fprintf(stderr, "BAThash: statistics (" BUNFMT ", entries " LLFMT", 
mask " BUNFMT", max " LLFMT ", avg %2.6f);\n", BATcount(b), entries, h->mask, 
max, total/entries);
+}
 /*
  * The prime routine for the BAT layer is to create a new hash index.
  * Its argument is the element type and the maximum number of BUNs be
@@ -312,6 +334,7 @@ BAThash(BAT *b, BUN masksize)
                        break;
                }
                b->H->hash = h;
+               ALGODEBUG HASHcollisions(b,b->H->hash);
        }
        MT_lock_unset(&GDKhashLock(ABS(b->batCacheid)), "BAThash");
        if (o != NULL) {
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -128,6 +128,8 @@ q_create(int sz, const char *name)
 static void
 q_destroy(queue *q)
 {
+       MT_lock_destroy(&q->l);
+       MT_sema_destroy(&q->s);
        GDKfree(q->data);
        GDKfree(q);
 }
@@ -615,6 +617,7 @@ runMALdataflow(Client cntxt, MalBlkPtr m
        GDKfree(flow->edges);
        GDKfree(flow->nodes);
        q_destroy(flow->done);
+       MT_lock_destroy(&flow->flowlock);
        GDKfree(flow);
        return ret;
 }
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -801,14 +801,15 @@ str runMALsequence(Client cntxt, MalBlkP
                                                        bat bid = 
stk->stk[a].val.bval;
 
                                                        if (i < pci->retc && 
backup[i].val.bval) {
-                                                               
BBPdecref(backup[i].val.bval, TRUE);
+                                                               bat bx = 
backup[i].val.bval;
                                                                
backup[i].val.bval = 0;
+                                                               BBPdecref(bx, 
TRUE);
                                                        }
                                                        if (garbage[i] >= 0) {
+                                                               PARDEBUG 
mnstr_printf(GDKstdout, "#GC pc=%d bid=%d %s done\n", stkpc, bid, 
getVarName(mb, garbage[i]));
                                                                bid = 
ABS(stk->stk[garbage[i]].val.bval);
+                                                               
stk->stk[garbage[i]].val.bval = 0;
                                                                BBPdecref(bid, 
TRUE);
-                                                               PARDEBUG 
mnstr_printf(GDKstdout, "#GC pc=%d bid=%d %s done\n", stkpc, bid, 
getVarName(mb, garbage[i]));
-                                                               
stk->stk[garbage[i]].val.bval = 0;
                                                        }
                                                } else if (i < pci->retc &&
                                                                   0 < 
stk->stk[a].vtype &&
@@ -1439,8 +1440,8 @@ void releaseBAT(MalBlkPtr mb, MalStkPtr 
        do {
                for (k = 0; k < mb->vtop; k++)
                        if (stk->stk[k].vtype == TYPE_bat && 
abs(stk->stk[k].val.bval) == bid) {
+                               stk->stk[k].val.ival = 0;
                                BBPdecref(bid, TRUE);
-                               stk->stk[k].val.ival = 0;
                        }
                if (stk->up) {
                        stk = stk->up;
diff --git a/monetdb5/optimizer/Tests/tst4730.stable.out 
b/monetdb5/optimizer/Tests/tst4730.stable.out
--- a/monetdb5/optimizer/Tests/tst4730.stable.out
+++ b/monetdb5/optimizer/Tests/tst4730.stable.out
@@ -115,50 +115,50 @@ barrier always := true;                 
     V13{rows=1} := algebra.kdifference(V6{rows=1000:lng},V12{rows=1000});# 11 
V13:bat[:oid,:date] := ALGkdiff(V6:bat[:oid,:date], V12:bat[:oid,:oid]) {G}
     V16 := mtime.date_sub_sec_interval(A3,A4);# 12 V16:date := 
MTIMEdate_sub_sec_interval_wrap(A3:date, A4:int) 
     a := mtime.date(nil);               # 13 a:date := MTIMEnil2date(_31:void) 
-    V17{rows=1} := algebra.uselect(V13{rows=1},a,V16);# 14 V17:bat[:oid,:void] 
:= ALGuselect(V13:bat[:oid,:date], a:date, V16:date) {G}
-    V20{rows=1} := algebra.markT(V17{rows=1},0@0);# 15 V20:bat[:oid,:oid] := 
ALGtmark(V17:bat[:oid,:void], _34:oid) {G}
-    V21{rows=1} := bat.reverse(V20{rows=1});# 16 V21:bat[:oid,:oid] := 
BKCreverse(V20:bat[:oid,:oid]) {G}
+    V17 := algebra.uselect(V13{rows=1},a,V16);# 14 V17:bat[:oid,:void] := 
ALGuselect(V13:bat[:oid,:date], a:date, V16:date) {G}
+    V20 := algebra.markT(V17,0@0);      # 15 V20:bat[:oid,:oid] := 
ALGtmark(V17:bat[:oid,:void], _34:oid) {G}
+    V21 := bat.reverse(V20);            # 16 V21:bat[:oid,:oid] := 
BKCreverse(V20:bat[:oid,:oid]) {G}
     V26{rows=1} := algebra.kdifference(V22{rows=1000:lng},V12{rows=1000});# 17 
V26:bat[:oid,:bit] := ALGkdiff(V22:bat[:oid,:bit], V12:bat[:oid,:oid]) {G}
-    V27{rows=1} := algebra.join(V21{rows=1},V26{rows=1});# 18 
V27:bat[:oid,:bit] := ALGjoin(V21:bat[:oid,:oid], V26:bat[:oid,:bit]) {G}
-    (h,V28) := group.new(V27{rows=1});  # 19 (h:bat[:oid,:wrd], 
V28:bat[:oid,:oid]) := GRPgroup(V27:bat[:oid,:bit]) {G}
+    V27 := algebra.join(V21,V26{rows=1});# 18 V27:bat[:oid,:bit] := 
ALGjoin(V21:bat[:oid,:oid], V26:bat[:oid,:bit]) {G}
+    (h,V28) := group.new(V27);          # 19 (h:bat[:oid,:wrd], 
V28:bat[:oid,:oid]) := GRPgroup(V27:bat[:oid,:bit]) {G}
     V33{rows=1} := algebra.kdifference(V29{rows=1000:lng},V12{rows=1000});# 20 
V33:bat[:oid,:bit] := ALGkdiff(V29:bat[:oid,:bit], V12:bat[:oid,:oid]) {G}
-    V34{rows=1} := algebra.join(V21{rows=1},V33{rows=1});# 21 
V34:bat[:oid,:bit] := ALGjoin(V21:bat[:oid,:oid], V33:bat[:oid,:bit]) {G}
-    (Ext,V35) := group.derive(h,V28,V34{rows=1});# 22 (Ext:bat[:oid,:wrd], 
V35:bat[:oid,:oid]) := GRPderive(h:bat[:oid,:wrd], V28:bat[:oid,:oid], 
V34:bat[:oid,:bit]) {G}
+    V34 := algebra.join(V21,V33{rows=1});# 21 V34:bat[:oid,:bit] := 
ALGjoin(V21:bat[:oid,:oid], V33:bat[:oid,:bit]) {G}
+    (Ext,V35) := group.derive(h,V28,V34);# 22 (Ext:bat[:oid,:wrd], 
V35:bat[:oid,:oid]) := GRPderive(h:bat[:oid,:wrd], V28:bat[:oid,:oid], 
V34:bat[:oid,:bit]) {G}
     V36 := algebra.tunique(Ext);        # 23 V36:bat[:oid,:wrd] := 
ALGtunique(Ext:bat[:oid,:wrd]) {G}
     V37 := bat.mirror(V36);             # 24 V37:bat[:oid,:oid] := 
BKCmirror(V36:bat[:oid,:wrd]) {G}
-    V42 := algebra.join(V37,V27{rows=1});# 25 V42:bat[:oid,:bit] := 
ALGjoin(V37:bat[:oid,:oid], V27:bat[:oid,:bit]) {G}
+    V42 := algebra.join(V37,V27);       # 25 V42:bat[:oid,:bit] := 
ALGjoin(V37:bat[:oid,:oid], V27:bat[:oid,:bit]) {G}
     V43 := algebra.sort(V42);           # 26 V43:bat[:oid,:bit] := 
ALGhsort(V42:bat[:oid,:bit]) {G}
-    V51 := algebra.join(V37,V34{rows=1});# 27 V51:bat[:oid,:bit] := 
ALGjoin(V37:bat[:oid,:oid], V34:bat[:oid,:bit]) {G}
+    V51 := algebra.join(V37,V34);       # 27 V51:bat[:oid,:bit] := 
ALGjoin(V37:bat[:oid,:oid], V34:bat[:oid,:bit]) {G}
     V52 := group.refine(V43,V51);       # 28 V52:bat[:oid,:oid] := 
GRPrefine(V43:bat[:oid,:bit], V51:bat[:oid,:bit]) {G}
     V57{rows=1} := algebra.kdifference(V53{rows=1000:lng},V12{rows=1000});# 29 
V57:bat[:oid,:int] := ALGkdiff(V53:bat[:oid,:int], V12:bat[:oid,:oid]) {G}
-    V58{rows=1} := algebra.join(V21{rows=1},V57{rows=1});# 30 
V58:bat[:oid,:int] := ALGjoin(V21:bat[:oid,:oid], V57:bat[:oid,:int]) {G}
-    V59{rows=1} := aggr.sum(V58{rows=1},V35,V37);# 31 V59:bat[:oid,:lng] := 
AGGRsum3_lng(V58:bat[:oid,:int], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
+    V58 := algebra.join(V21,V57{rows=1});# 30 V58:bat[:oid,:int] := 
ALGjoin(V21:bat[:oid,:oid], V57:bat[:oid,:int]) {G}
+    V59 := aggr.sum(V58,V35,V37);       # 31 V59:bat[:oid,:lng] := 
AGGRsum3_lng(V58:bat[:oid,:int], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
     V64{rows=1} := algebra.kdifference(V60{rows=1000:lng},V12{rows=1000});# 32 
V64:bat[:oid,:flt] := ALGkdiff(V60:bat[:oid,:flt], V12:bat[:oid,:oid]) {G}
-    V65{rows=1} := algebra.join(V21{rows=1},V64{rows=1});# 33 
V65:bat[:oid,:flt] := ALGjoin(V21:bat[:oid,:oid], V64:bat[:oid,:flt]) {G}
-    V66{rows=1} := aggr.sum(V65{rows=1},V35,V37);# 34 V66:bat[:oid,:dbl] := 
AGGRsum3_dbl(V65:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
+    V65 := algebra.join(V21,V64{rows=1});# 33 V65:bat[:oid,:flt] := 
ALGjoin(V21:bat[:oid,:oid], V64:bat[:oid,:flt]) {G}
+    V66 := aggr.sum(V65,V35,V37);       # 34 V66:bat[:oid,:dbl] := 
AGGRsum3_dbl(V65:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
     V72 := calc.lng(A0);                # 35 V72:lng := CMDvarCONVERT(A0:sht) 
     V74 := calc.*(V72,100);             # 36 V74:lng := 
CMDvarMULsignal(V72:lng, _58:int) 
     V82{rows=1} := algebra.kdifference(V75{rows=1000:lng},V12{rows=1000});# 37 
V82:bat[:oid,:flt] := ALGkdiff(V75:bat[:oid,:flt], V12:bat[:oid,:oid]) {G}
-    V83{rows=1} := algebra.join(V21{rows=1},V82{rows=1});# 38 
V83:bat[:oid,:flt] := ALGjoin(V21:bat[:oid,:oid], V82:bat[:oid,:flt]) {G}
-    V84:bat[:oid,:flt]  := mal.multiplex("calc.-",V74,V83{rows=1});# 39 
V84:bat[:oid,:flt] := OPTremapMultiplex(_62:str, V74:lng, V83:bat[:oid,:flt]) 
{G}
-    V86{rows=1} := batcalc.*(V65{rows=1},V84);# 40 V86:bat[:oid,:flt] := 
CMDbatMULsignal(V65:bat[:oid,:flt], V84:bat[:oid,:flt]) {G}
-    V88{rows=1} := aggr.sum(V86{rows=1},V35,V37);# 41 V88:bat[:oid,:dbl] := 
AGGRsum3_dbl(V86:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
+    V83 := algebra.join(V21,V82{rows=1});# 38 V83:bat[:oid,:flt] := 
ALGjoin(V21:bat[:oid,:oid], V82:bat[:oid,:flt]) {G}
+    V84:bat[:oid,:flt]  := mal.multiplex("calc.-",V74,V83);# 39 
V84:bat[:oid,:flt] := OPTremapMultiplex(_62:str, V74:lng, V83:bat[:oid,:flt]) 
{G}
+    V86 := batcalc.*(V65,V84);          # 40 V86:bat[:oid,:flt] := 
CMDbatMULsignal(V65:bat[:oid,:flt], V84:bat[:oid,:flt]) {G}
+    V88 := aggr.sum(V86,V35,V37);       # 41 V88:bat[:oid,:dbl] := 
AGGRsum3_dbl(V86:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
     V94 := calc.lng(A1);                # 42 V94:lng := CMDvarCONVERT(A1:sht) 
     V95 := calc.*(V94,100);             # 43 V95:lng := 
CMDvarMULsignal(V94:lng, _58:int) 
-    V100:bat[:oid,:flt]  := mal.multiplex("calc.-",V95,V83{rows=1});# 44 
V100:bat[:oid,:flt] := OPTremapMultiplex(_62:str, V95:lng, V83:bat[:oid,:flt]) 
{G}
-    V101{rows=1} := batcalc.*(V65{rows=1},V100);# 45 V101:bat[:oid,:flt] := 
CMDbatMULsignal(V65:bat[:oid,:flt], V100:bat[:oid,:flt]) {G}
+    V100:bat[:oid,:flt]  := mal.multiplex("calc.-",V95,V83);# 44 
V100:bat[:oid,:flt] := OPTremapMultiplex(_62:str, V95:lng, V83:bat[:oid,:flt]) 
{G}
+    V101 := batcalc.*(V65,V100);        # 45 V101:bat[:oid,:flt] := 
CMDbatMULsignal(V65:bat[:oid,:flt], V100:bat[:oid,:flt]) {G}
     V103 := calc.lng(A2);               # 46 V103:lng := CMDvarCONVERT(A2:sht) 
     V104 := calc.*(V103,100);           # 47 V104:lng := 
CMDvarMULsignal(V103:lng, _58:int) 
     V109{rows=1} := algebra.kdifference(V105{rows=1000:lng},V12{rows=1000});# 
48 V109:bat[:oid,:flt] := ALGkdiff(V105:bat[:oid,:flt], V12:bat[:oid,:oid]) {G}
-    V110{rows=1} := algebra.join(V21{rows=1},V109{rows=1});# 49 
V110:bat[:oid,:flt] := ALGjoin(V21:bat[:oid,:oid], V109:bat[:oid,:flt]) {G}
-    V111:bat[:oid,:flt]  := mal.multiplex("calc.+",V104,V110{rows=1});# 50 
V111:bat[:oid,:flt] := OPTremapMultiplex(_74:str, V104:lng, 
V110:bat[:oid,:flt]) {G}
-    V113{rows=1} := batcalc.*(V101{rows=1},V111);# 51 V113:bat[:oid,:flt] := 
CMDbatMULsignal(V101:bat[:oid,:flt], V111:bat[:oid,:flt]) {G}
-    V114{rows=1} := aggr.sum(V113{rows=1},V35,V37);# 52 V114:bat[:oid,:dbl] := 
AGGRsum3_dbl(V113:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
-    V122{rows=1} := aggr.avg(V58{rows=1},V35,V37);# 53 V122:bat[:oid,:dbl] := 
AGGRavg3_dbl(V58:bat[:oid,:int], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
-    V127{rows=1} := aggr.avg(V65{rows=1},V35,V37);# 54 V127:bat[:oid,:dbl] := 
AGGRavg3_dbl(V65:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
-    V129 := mal.multiplex("calc.round",V127{rows=1},100);# 55 V129:any := 
OPTremapMultiplex(_80:str, V127:bat[:oid,:dbl], _58:int) {G}
-    V135{rows=1} := aggr.avg(V83{rows=1},V35,V37);# 56 V135:bat[:oid,:dbl] := 
AGGRavg3_dbl(V83:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
-    V136 := mal.multiplex("calc.round",V135{rows=1},100);# 57 V136:any := 
OPTremapMultiplex(_80:str, V135:bat[:oid,:dbl], _58:int) {G}
+    V110 := algebra.join(V21,V109{rows=1});# 49 V110:bat[:oid,:flt] := 
ALGjoin(V21:bat[:oid,:oid], V109:bat[:oid,:flt]) {G}
+    V111:bat[:oid,:flt]  := mal.multiplex("calc.+",V104,V110);# 50 
V111:bat[:oid,:flt] := OPTremapMultiplex(_74:str, V104:lng, 
V110:bat[:oid,:flt]) {G}
+    V113 := batcalc.*(V101,V111);       # 51 V113:bat[:oid,:flt] := 
CMDbatMULsignal(V101:bat[:oid,:flt], V111:bat[:oid,:flt]) {G}
+    V114 := aggr.sum(V113,V35,V37);     # 52 V114:bat[:oid,:dbl] := 
AGGRsum3_dbl(V113:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
+    V122 := aggr.avg(V58,V35,V37);      # 53 V122:bat[:oid,:dbl] := 
AGGRavg3_dbl(V58:bat[:oid,:int], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
+    V127 := aggr.avg(V65,V35,V37);      # 54 V127:bat[:oid,:dbl] := 
AGGRavg3_dbl(V65:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
+    V129 := mal.multiplex("calc.round",V127,100);# 55 V129:any := 
OPTremapMultiplex(_80:str, V127:bat[:oid,:dbl], _58:int) {G}
+    V135 := aggr.avg(V83,V35,V37);      # 56 V135:bat[:oid,:dbl] := 
AGGRavg3_dbl(V83:bat[:oid,:flt], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
+    V136 := mal.multiplex("calc.round",V135,100);# 57 V136:any := 
OPTremapMultiplex(_80:str, V135:bat[:oid,:dbl], _58:int) {G}
     V137 := aggr.count(V35,V35,V37);    # 58 V137:bat[:oid,:wrd] := 
AGGRcount3nils(V35:bat[:oid,:oid], V35:bat[:oid,:oid], V37:bat[:oid,:oid]) {G}
 #sql.column(V42,"l_returnflag","varchar",1,0); 
 #sql.column(V51,"l_linestatus","varchar",1,0); 
diff --git a/sql/backends/monet5/datacell/Tests/scenario01.sql 
b/sql/backends/monet5/datacell/Tests/scenario01.sql
--- a/sql/backends/monet5/datacell/Tests/scenario01.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario01.sql
@@ -21,4 +21,4 @@ select * from datacell.receptors(); sele
 drop table datacell.bsktin;
 drop table datacell.bsktout;
 
--- sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1 
--protocol=udp
+-- sensor --host=localhost --port=50501 --events=100 --columns=3 --delay=1 
--protocol=udp
diff --git a/sql/backends/monet5/datacell/Tests/scenario04.sql 
b/sql/backends/monet5/datacell/Tests/scenario04.sql
--- a/sql/backends/monet5/datacell/Tests/scenario04.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario04.sql
@@ -23,7 +23,8 @@ call datacell.resume();
 call datacell.dump();
 
 -- externally, activate the sensor 
---sensor --host=localhost --port=504444--events=100 --columns=3 --delay=1
+-- sensor --host=localhost --port=50504 --events=100 --columns=3 --delay=1
+-- nc -l -u 50604
 -- externally, activate the actuator server to listen
 -- actuator 
 
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -3011,7 +3011,10 @@ rel_remove_empty_select(int *changes, mv
 /*
  * Push {semi}joins down, pushes the joins through group by expressions. 
  * When the join is on the group by columns, we can push the joins left
- * under the group by.
+ * under the group by. This should only be done, iff the new semijoin would
+ * reduce the input table to the groupby. So there should be a reduction 
+ * (selection) on the table A and this should be propagated to the groupby via
+ * for example a primary key.
  *
  * {semi}join( A, groupby( B ) [gbe][aggrs] ) [ gbe == A.x ]
  * ->
@@ -3096,11 +3099,12 @@ rel_push_join_down(int *changes, mvc *sq
                                                        fnd = 1;
                                                }
                                                if (fnd) {
+                                                       sql_exp *le = je->l;
                                                        sql_exp *re = 
exp_push_down_prj(sql, r, gb, gb->l);
-                                                       if (!re) {
+                                                       if (!re || 
(list_length(jes) == 0 && !find_prop(le->p, PROP_HASHCOL))) {
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to