Changeset: 7e3a5f06c35f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7e3a5f06c35f
Modified Files:
        clients/Tests/SQL-dump.stable.out
        clients/Tests/exports.stable.out
        clients/mapiclient/mclient.c
        clients/ruby/Tests/rubytest.stable.out
        monetdb5/mal/mal.h
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_instruction.h
        monetdb5/optimizer/opt_constants.c
        monetdb5/optimizer/opt_costModel.c
        monetdb5/optimizer/opt_mitosis.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        sql/backends/monet5/sql_optimizer.c
        sql/test/copy/Tests/key_copy.stable.err
        sql/test/mergetables/Tests/mergequery.stable.out
        sql/test/remote/Tests/partition_elim.stable.out
        testing/Mfilter.py
Branch: embedded
Log Message:

merge with default


diffs (truncated from 1537 to 300 lines):

diff --git a/clients/Tests/SQL-dump.stable.out 
b/clients/Tests/SQL-dump.stable.out
--- a/clients/Tests/SQL-dump.stable.out
+++ b/clients/Tests/SQL-dump.stable.out
@@ -1869,7 +1869,6 @@ CREATE TABLE "sys"."args" (
        "number"      INTEGER
 );
 COPY 3799 RECORDS INTO "sys"."args" FROM stdin USING DELIMITERS '\t','\n','"';
-======= end
 2155   28      "res_0" "oid"   63      0       0       0
 2156   28      "arg_1" "wrd"   64      0       1       1
 2157   29      "res_0" "oid"   63      0       0       0
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2342,7 +2342,6 @@ char monet_characteristics[PATHLENGTH];
 char monet_cwd[PATHLENGTH];
 size_t monet_memory;
 void moveInstruction(MalBlkPtr mb, int pc, int target);
-int mtProp;
 str mtimeRef;
 str mulRef;
 str multicolumnRef;
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2134,11 +2134,19 @@ myread(void *private, void *buf, size_t 
        if (size == 0)
                return cnt;
        if (p->buf == NULL) {
+               rl_completion_func_t *func = NULL;
+
+               if (strcmp(p->prompt, "more>") == 0)
+                       func = suspend_completion();
                p->buf = readline(p->prompt);
+               if (func)
+                       continue_completion(func);
                if (p->buf == NULL)
                        return 0;
                p->len = strlen(p->buf);
                p->read = 0;
+               if (p->len > 1)
+                       save_line(p->buf);
        }
        if (p->read < p->len) {
                if (p->len - p->read < size)
diff --git a/clients/ruby/Tests/rubytest.stable.out 
b/clients/ruby/Tests/rubytest.stable.out
--- a/clients/ruby/Tests/rubytest.stable.out
+++ b/clients/ruby/Tests/rubytest.stable.out
@@ -62,12 +62,15 @@ Ready.
 # 11:46:09 >  "ruby" "rubytest.rb" "33382" "mTests_clients_ruby"
 # 11:46:09 >  
 
-# Running:
+Run options: --seed 42454
+
+# Running tests:
+
 ...........
 
+Finished tests in 0.242699s, 45.3236 tests/s, 45.3236 assertions/s.
 
-
-11 runs, 11 assertions, 0 failures, 0 errors, 0 skips
+11 tests, 11 assertions, 0 failures, 0 errors, 0 skips
 
 # 11:46:09 >  
 # 11:46:09 >  "Done."
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -178,6 +178,7 @@ typedef struct {
        int pc;                                         /* location in MAL plan 
for profiler*/
        MALfcn fcn;                                     /* resolved function 
address */
        struct MALBLK *blk;                     /* resolved MAL function 
address */
+       int mitosis;                            /* old mtProp value */
        /* inline statistics */
        struct timeval clock;           /* when the last call was started */
        lng ticks;                                      /* total micro seconds 
spent in last call */
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -480,6 +480,7 @@ newInstruction(MalBlkPtr mb, int kind)
        p->recycle = 0;
        p->argc = 1;
        p->retc = 1;
+       p->mitosis = -1;
        p->argv[0] = -1;                        /* watch out for direct use in 
variable table */
        /* Flow of control instructions are always marked as an assignment
         * with modifier */
diff --git a/monetdb5/mal/mal_instruction.h b/monetdb5/mal/mal_instruction.h
--- a/monetdb5/mal/mal_instruction.h
+++ b/monetdb5/mal/mal_instruction.h
@@ -95,6 +95,10 @@
 
 #define setRowCnt(M,I,C)       (M)->var[I]->rowcnt = C
 #define getRowCnt(M,I)         ((M)->var[I]->rowcnt)
+
+#define setMitosisPartition(P,C)       (P)->mitosis = C
+#define getMitosisPartition(P)         ((P)->mitosis)
+
 #define getDestVar(P)          (P)->argv[0]
 #define setDestVar(P,X)                (P)->argv[0]  =X
 #define setDestType(M,P,V)     setVarType((M),getDestVar(P),V)
diff --git a/monetdb5/optimizer/opt_constants.c 
b/monetdb5/optimizer/opt_constants.c
--- a/monetdb5/optimizer/opt_constants.c
+++ b/monetdb5/optimizer/opt_constants.c
@@ -56,6 +56,7 @@ OPTconstantsImplementation(Client cntxt,
                        for( k= n-1; k>=0; k--){
                                y= cst[k];
                                if ( x->type == y->type &&
+                                        x->rowcnt == y->rowcnt &&
                                         x->value.vtype == y->value.vtype &&
                                        ATOMcmp(x->value.vtype, 
VALptr(&x->value), VALptr(&y->value)) == 0){
                                        OPTDEBUGconstants {
diff --git a/monetdb5/optimizer/opt_costModel.c 
b/monetdb5/optimizer/opt_costModel.c
--- a/monetdb5/optimizer/opt_costModel.c
+++ b/monetdb5/optimizer/opt_costModel.c
@@ -15,9 +15,12 @@
 #define newRows(W,X,Y,Z) {\
                c1 = getRowCnt(mb, getArg(p,W));\
                c2 = getRowCnt(mb, getArg(p,X));\
-               if (c1 == -1 || c2 == -1) \
+               /* just to ensure that rowcnt was/is never set to -1 */\
+               assert(c1 != (BUN) -1);\
+               assert(c2 != (BUN) -1);\
+               if (c1 == BUN_NONE || c2 == BUN_NONE) \
                        continue;\
-               setRowCnt(mb, getArg(p,Z), (BUN)(Y));\
+               setRowCnt(mb, getArg(p,Z), (Y));\
 }
 /*
  * The cost will be used in many places to make decisions.
@@ -33,7 +36,7 @@ int
 OPTcostModelImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci)
 {
        int i;
-       wrd c1, c2;
+       BUN c1, c2;
        InstrPtr p;
 
        (void) cntxt;
@@ -105,10 +108,10 @@ OPTcostModelImplementation(Client cntxt,
                        } else if (getFunctionId(p) == deleteRef){
                                if( isaBatType(getArgType(mb,p,2)) ){
                                        /* delete BAT */
-                                       newRows(1,2, (c1 - c2 ==0? 1: c1-c2),1);
+                                       newRows(1, 2, (c2 == c1 ? 1 : c1 - c2), 
1);
                                } else {
                                        /* insert scalars */
-                                       newRows(1,1, (c1==1?1: c1-1),1);
+                                       newRows(1, 1, (c1 == 1 ? 1 : c1 - 1), 
1);
                                }
                        } else if (getFunctionId(p) == insertRef){
                                newRows(1,1,( c1 + 1),0); /* faked */
@@ -124,15 +127,17 @@ OPTcostModelImplementation(Client cntxt,
                                getFunctionId(p) == minRef ||
                                getFunctionId(p) == maxRef ||
                                getFunctionId(p) == avgRef) {
-                               newRows(1,1, ( c1?c1:c1+1),0);
+                               newRows(1, 1, (c1 != 0 ? c1 : 1), 0);
                        } else  if (getFunctionId(p) == countRef){
                                newRows(1,1, 1,0);
                        }
                } else if( p->token == ASSIGNsymbol && p->argc== 2){
                        /* copy the rows property */
                        c1 = getRowCnt(mb, getArg(p,1));
-                       if (c1 != -1)
-                               setRowCnt(mb, getArg(p,0), (BUN) c1);
+                       /* just to ensure that rowcnt was/is never set to -1 */
+                       assert(c1 != (BUN) -1);
+                       if (c1 != BUN_NONE)
+                               setRowCnt(mb, getArg(p,0), c1);
                }
        }
        return 1;
diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c
--- a/monetdb5/optimizer/opt_mitosis.c
+++ b/monetdb5/optimizer/opt_mitosis.c
@@ -29,19 +29,6 @@ eligible(MalBlkPtr mb)
        return 1;
 }
 
-static int
-getVarMergeTableId(MalBlkPtr mb, int v)
-{
-       VarPtr p = varGetProp(mb, v, mtProp);
-
-       if (!p)
-               return -1;
-       if (p->value.vtype == TYPE_int)
-               return p->value.val.ival;
-       return -1;
-}
-
-
 /* The plans are marked with the concurrent user load.
  *  * If this has changed, we may want to recompile the query
  *   */
@@ -61,9 +48,9 @@ OPTmitosisImplementation(Client cntxt, M
 {
        int i, j, limit, slimit, estimate = 0, pieces = 1, mito_parts = 0, 
mito_size = 0, row_size = 0, mt = -1;
        str schema = 0, table = 0;
-       wrd r = 0, rowcnt = 0;    /* table should be sizeable to consider 
parallel execution*/
+       BUN r = 0, rowcnt = 0;    /* table should be sizeable to consider 
parallel execution*/
        InstrPtr q, *old, target = 0;
-       size_t argsize = 6 * sizeof(lng);
+       size_t argsize = 6 * sizeof(lng), m = 0;
        /*     per op:   6 = (2+1)*2   <=  2 args + 1 res, each with head & 
tail */
        int threads = GDKnr_threads ? GDKnr_threads : 1;
        int activeClients;
@@ -136,28 +123,28 @@ OPTmitosisImplementation(Client cntxt, M
         * Take into account the number of client connections, 
         * because all user together are responsible for resource contentions
         */
-       r = (wrd) (monet_memory / argsize);
+       m = monet_memory / argsize;
        /* if data exceeds memory size,
         * i.e., (rowcnt*argsize > monet_memory),
-        * i.e., (rowcnt > monet_memory/argsize = r) */
-       if (rowcnt > r && r / threads / activeClients > 0) {
+        * i.e., (rowcnt > monet_memory/argsize = m) */
+       if (rowcnt > m && m / threads / activeClients > 0) {
                /* create |pieces| > |threads| partitions such that
                 * |threads| partitions at a time fit in memory,
-                * i.e., (threads*(rowcnt/pieces) <= r),
-                * i.e., (rowcnt/pieces <= r/threads),
-                * i.e., (pieces => rowcnt/(r/threads))
-                * (assuming that (r > threads*MINPARTCNT)) */
-               pieces = (int) (rowcnt / (r / threads / activeClients)) + 1;
+                * i.e., (threads*(rowcnt/pieces) <= m),
+                * i.e., (rowcnt/pieces <= m/threads),
+                * i.e., (pieces => rowcnt/(m/threads))
+                * (assuming that (m > threads*MINPARTCNT)) */
+               pieces = (int) (rowcnt / (m / threads / activeClients)) + 1;
        } else if (rowcnt > MINPARTCNT) {
        /* exploit parallelism, but ensure minimal partition size to
         * limit overhead */
-               pieces = (int) MIN((rowcnt / MINPARTCNT), (wrd) threads);
+               pieces = (int) MIN(rowcnt / MINPARTCNT, (BUN) threads);
        }
        /* when testing, always aim for full parallelism, but avoid
         * empty pieces */
        FORCEMITODEBUG
        if (pieces < threads)
-               pieces = (int) MIN((wrd) threads, rowcnt);
+               pieces = (int) MIN((BUN) threads, rowcnt);
        /* prevent plan explosion */
        if (pieces > MAXSLICES)
                pieces = MAXSLICES;
@@ -173,12 +160,12 @@ OPTmitosisImplementation(Client cntxt, M
 
        OPTDEBUGmitosis
        mnstr_printf(cntxt->fdout, "#opt_mitosis: target is %s.%s "
-                                                          " with " SSZFMT " 
rows of size %d into " SSZFMT 
+                                                          " with " BUNFMT " 
rows of size %d into " SZFMT
                                                                " rows/piece %d 
threads %d pieces"
                                                                " fixed parts 
%d fixed size %d\n",
                                 getVarConstant(mb, getArg(target, 2)).val.sval,
                                 getVarConstant(mb, getArg(target, 3)).val.sval,
-                                rowcnt, row_size, r, threads, pieces, 
mito_parts, mito_size);
+                                rowcnt, row_size, m, threads, pieces, 
mito_parts, mito_size);
        if (pieces <= 1)
                return 0;
 
@@ -190,7 +177,6 @@ OPTmitosisImplementation(Client cntxt, M
 
        schema = getVarConstant(mb, getArg(target, 2)).val.sval;
        table = getVarConstant(mb, getArg(target, 3)).val.sval;
-       mt = getVarMergeTableId(mb, getArg(target, 0));
        for (i = 0; i < limit; i++) {
                int upd = 0, qtpe, rtpe = 0, qv, rv;
                InstrPtr matq, matr = NULL;
@@ -216,12 +202,14 @@ OPTmitosisImplementation(Client cntxt, M
                }
                if (p->retc == 2)
                        upd = 1;
+               if( mt == -1)
+                       mt = getMitosisPartition(p);
                if (mt < 0 && (strcmp(schema, getVarConstant(mb, getArg(p, 2 + 
upd)).val.sval) ||
                               strcmp(table, getVarConstant(mb, getArg(p, 3 + 
upd)).val.sval))) {
                        pushInstruction(mb, p);
                        continue;
                }
-               if (mt >= 0 && getVarMergeTableId(mb, getArg(p, 0)) != mt) {
+               if (mt >= 0 && getMitosisPartition(p) != mt) {
                        pushInstruction(mb, p);
                        continue;
                }
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
@@ -235,7 +235,6 @@ int unsafeProp;
 
 int horiginProp;               /* original oid source */
 int toriginProp;               /* original oid source */
-int mtProp;
 
 void optimizerInit(void)
 {
@@ -459,7 +458,6 @@ void optimizerInit(void)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to