Changeset: c6c1627e68a3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c6c1627e68a3
Modified Files:
        monetdb5/mal/mal_listing.c
        sql/server/rel_dump.c
Branch: mal_opt_output
Log Message:

Increase aux buf for safety.
Take into account normal remarks and opt remarks.
Add hash symb to rel plan.


diffs (70 lines):

diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c
--- a/monetdb5/mal/mal_listing.c
+++ b/monetdb5/mal/mal_listing.c
@@ -276,33 +276,32 @@ fcnDefinition(MalBlkPtr mb, InstrPtr p, 
 static str
 fmtRemark(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, str t, int flg, str base, 
size_t len)
 {
-       int i;
-       char aux[64]; //no mal opt func name is bigger then this
-       str arg;
+       char aux[128]; //no mal opt func name is bigger then this
 
-       if (getFunctionId(pci)) {
-               snprintf(aux, 64, "%-39s", getFunctionId(pci));
-               if (!copystring(&t, aux, &len))
-                       return base;
+       if (!copystring(&t, "# ", &len))
+               return base;
+       //optimizer remark, i=1 actions field, i=2 usec field
+       if (pci && pci->argc == 3) {
+               if (getFunctionId(pci)) {
+                       snprintf(aux, 128, "%-39s %d actions %ld usec",
+                                        getFunctionId(pci),
+                                        atoi(renderTerm(mb, stk, pci, 1, flg)),
+                                        atol(renderTerm(mb, stk, pci, 2, 
flg)));
+                       if (!copystring(&t, aux, &len))
+                               return base;
+               }
        }
-       for (i = pci->retc; i < pci->argc; i++) {
-               arg = renderTerm(mb, stk, pci, i, flg);
-               if (arg) {
-                       if (i == 1) {
-                               snprintf(aux, 64, "%d actions", atoi(arg));
-                       }
-                       else if (i == 2) {
-                               snprintf(aux, 64, "%ld usec", atol(arg));
-                       }
-                       if (!copystring(&t, aux, &len)) {
-                               GDKfree(arg);
+       else if (pci->argc == 1) {
+               if (getFunctionId(pci)) {
+                       if (!copystring(&t, getFunctionId(pci), &len))
                                return base;
-                       }
-                       GDKfree(arg);
                }
-               if (i < pci->argc -1 && !copystring(&t, " ", &len))
-                       return base;
        }
+       else if (getVar(mb, getArg(pci, 0))->value.val.sval &&
+                        getVar(mb, getArg(pci, 0))->value.len > 0 &&
+                        !copystring(&t, getVar(mb, getArg(pci, 
0))->value.val.sval, &len))
+               return base;
+
        return base;
 }
 
diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -685,7 +685,7 @@ rel_print_(mvc *sql, stream *fout, sql_r
 
                        if (run->name) { /* if name is set, then the optimizer 
did run */
                                print_indent(sql, fout, depth, decorate);
-                               mnstr_printf(fout, "%-36s %3d actions " LLFMT " 
usec",
+                               mnstr_printf(fout, "# %-36s %3d actions " LLFMT 
" usec",
                                                         run->name, 
run->nchanges, run->time);
                        }
                }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to