Changeset: 584074062c90 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=584074062c90
Added Files:
        sql/backends/monet5/Tests/pyloader06.stable.out.32bit
        sql/backends/monet5/Tests/pyloader07.stable.out.32bit
        sql/test/BugTracker-2017/Tests/groupby_assertion.Bug-6338.stable.err
        sql/test/BugTracker-2017/Tests/groupby_assertion.Bug-6338.stable.out
        sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.stable.err
        sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.stable.out
Modified Files:
        clients/Tests/mclient-uri.SQL.sh
        clients/mapiclient/Tests/mclient--help.stable.err
        clients/mapiclient/mclient.1
        clients/mapiclient/mclient.c
        gdk/gdk_aggr.c
        monetdb5/optimizer/Tests/manifold2.stable.out.single
        sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out
        sql/benchmarks/tpch/LOCKED/Tests/12.stable.out
        sql/benchmarks/tpch/LOCKED/Tests/16.stable.out
        sql/benchmarks/tpch/LOCKED/Tests/18.stable.out
        sql/benchmarks/tpch/LOCKED/Tests/19.stable.out
        sql/benchmarks/tpch/LOCKED/Tests/22.stable.out
        sql/benchmarks/tpch/Tests/01-22.stable.out
        sql/benchmarks/tpch/Tests/12.stable.out
        sql/benchmarks/tpch/Tests/16.stable.out
        sql/benchmarks/tpch/Tests/18.stable.out
        sql/benchmarks/tpch/Tests/19.stable.out
        sql/benchmarks/tpch/Tests/22.stable.out
        sql/server/rel_optimizer.c
        sql/server/rel_select.c
        sql/server/rel_updates.c
        sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.out
        sql/test/BugTracker-2017/Tests/lateral.Bug-6310.stable.err
        sql/test/BugTracker-2017/Tests/lateral.Bug-6310.stable.out
        sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.sql
        sql/test/BugTracker-2017/Tests/spurious_error.Bug-6344.stable.out
        sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6477.stable.err
        sql/test/emptydb/Tests/check.stable.out.32bit
        testing/Mtest.py.in
Branch: jitudf
Log Message:

Merge with default.


diffs (truncated from 1742 to 300 lines):

diff --git a/clients/Tests/mclient-uri.SQL.sh b/clients/Tests/mclient-uri.SQL.sh
--- a/clients/Tests/mclient-uri.SQL.sh
+++ b/clients/Tests/mclient-uri.SQL.sh
@@ -2,8 +2,8 @@
 
 # test the URI parsing capabilities of the MAPI library
 
-Mlog "mclient -d 
mapi:monetdb://$HOST:$MAPIPORT/$TSTDB?language=sql&user=monetdb -f test -E 
utf-8 -s select 1"
+Mlog "mclient -d 
mapi:monetdb://$HOST:$MAPIPORT/$TSTDB?language=sql&user=monetdb -f test -t 
none-E utf-8 -s select 1"
 mclient -d "mapi:monetdb://$HOST:$MAPIPORT/$TSTDB?language=sql&user=monetdb" 
-f test -E utf-8 -s 'select 1'
 
-Mlog "mclient -d 
mapi:monetdb://$MAPIHOST/.s.monetdb.$MAPIPORT?database=$TSTDB&language=sql&user=monetdb
 -f test -E utf-8 -s select 1"
+Mlog "mclient -d 
mapi:monetdb://$MAPIHOST/.s.monetdb.$MAPIPORT?database=$TSTDB&language=sql&user=monetdb
 -f test -t none -E utf-8 -s select 1"
 mclient -d 
"mapi:monetdb://$MAPIHOST/.s.monetdb.$MAPIPORT?database=$TSTDB&language=sql&user=monetdb"
 -f test -E utf-8 -s 'select 1'
diff --git a/clients/mapiclient/Tests/mclient--help.stable.err 
b/clients/mapiclient/Tests/mclient--help.stable.err
--- a/clients/mapiclient/Tests/mclient--help.stable.err
+++ b/clients/mapiclient/Tests/mclient--help.stable.err
@@ -19,9 +19,10 @@ Options are:
  -d database | --database=database  database to connect to (may be URI)
  -e          | --echo            echo the query
  -E charset  | --encoding=charset specify encoding (character set) of the 
terminal
- -f kind     | --format=kind      specify output format {csv,tab,raw,sql,xml}
+ -f kind     | --format=kind      specify output format 
{csv,tab,raw,sql,xml,trash}
  -H          | --history         load/save cmdline history (default off)
- -i          | --interactive[=tm] interpret `\' commands on stdin, use time 
formatting {ms,s,m}
+ -i          | --interactive      interpret `\' commands on stdin
+ -t          | --timer=format     use time formatting 
{clock,minutes,seconds,milliseconds,microseconds,none}
  -l language | --language=lang    {sql,mal}
  -L logfile  | --log=logfile     save client/server interaction
  -s stmt     | --statement=stmt  run single statement
diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1
--- a/clients/mapiclient/mclient.1
+++ b/clients/mapiclient/mclient.1
@@ -148,22 +148,17 @@ these are supported.
 Specify the portnumber of the server (default:
 .BR 50000 ).
 .TP
-\fB\-\-interactive\fP[\fB=\fP\fItimermode\fP] (\fB\-i\fP[\fItimermode\fP])
+\fB\-\-interactive\fP
 When reading from standard input, interpret lines starting with
 .B \e
 (backslash) specially.
 See the section BACKSLASH COMMANDS below.
-This is the default if standard input is a terminal.
-The optional \fItimermode\fP argument controls the
-format of the time reported for queries.
-Note that no space is allowed between
-.B \-i
-and
-.IR timermode .
-The default mode is
-\fBhuman\fP which adjusts the time precision to the measured value.
-The modes \fBms\fP, \fBs\fP and \fBm\fP force millisecond, second and
-minute + second precision respectively.
+
+\fB\-\-timer\fP[\fB=\fP\fItimermode\fP] 
+The \fItimer\fP command controls the format of the time reported for queries.
+The default mode is \fBclock\fP which reports on the wall-clock time in a 
human friendly way.
+The timer mode \fBnone\fP turns off timing reporting.
+The timer mode \fBperformance\fP shows the timing components in millisecond 
resolution.
 .TP
 \fB\-\-user\fP\fB=\fP\fIuser\fP (\fB\-u\fP \fIuser\fP)
 Specify the user to connect as.
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -87,18 +87,18 @@ static int errseen = 0;
 #define setPrompt() sprintf(promptbuf, "%.*s>", (int) sizeof(promptbuf) - 2, 
language)
 #define debugMode() (strncmp(promptbuf, "mdb", 3) == 0)
 
-/* the internal formatters */
+/* the internal result set formatters */
 enum formatters {
        NOformatter,
-       RAWformatter,
-       TABLEformatter,
-       CSVformatter,
-       XMLformatter,
-       TESTformatter,
-       CLEANformatter,
-       TIMERformatter,
-       SAMformatter,
-       EXPANDEDformatter
+       RAWformatter,           // as the data is received
+       TABLEformatter,         // render as a bordered table
+       CSVformatter,           // render as a comma separate file
+       XMLformatter,           // render as a valid XML document
+       JSONformatter,          // render as a valid JSON document
+       TESTformatter,          // for testing, escape characters
+       TRASHformatter,         // remove the result set 
+       SAMformatter,           // render a SAM result set
+       EXPANDEDformatter       // render as multi-row single record
 };
 static enum formatters formatter = NOformatter;
 char *separator = NULL;                /* column separator for CSV/TAB format 
*/
@@ -109,9 +109,6 @@ int csvheader = 0;          /* include header li
 /* use a 64 bit integer for the timer */
 typedef int64_t timertype;
 #define TTFMT "%" PRId64
-#if 0
-static char *mark, *mark2;
-#endif
 
 static timertype t0, t1;       /* used for timing */
 
@@ -264,12 +261,6 @@ timerEnd(void)
        mnstr_flush(toConsole);
        t1 = gettime();
        assert(t1 >= t0);
-#if 0
-       if (mark && specials == NOmodifier) {
-               fprintf(stderr, "%s " TTFMT ".%03d msec %s\n", mark, (t1 - t0) 
/ 1000, (int) ((t1 - t0) % 1000), mark2 ? mark2 : "");
-               fflush(stderr);
-       }
-#endif
 }
 
 static timertype th = 0;
@@ -280,33 +271,43 @@ timerHumanStop(void)
 }
 
 static enum itimers {
-       T_HUMAN = 0,
-       T_MILLIS,
-       T_SECS,
-       T_MINSECS
-} itimemode = T_HUMAN;
+       T_CLOCK = 0,    // render wallclock time in human readable format
+       T_PERF,         // return detailed performance
+       T_NONE          // don't render the timing information
+} timermode = T_CLOCK;
 
-static char htimbuf[32];
+static char htimbuf[128];
 static char *
-timerHuman(void)
+timerHuman(int64_t sqloptimizer, int64_t maloptimizer, int64_t querytime)
 {
        timertype t = th - t0;
 
-       assert(th >= t0);
 
-       if (itimemode == T_MILLIS || (itimemode == T_HUMAN && t / 1000 < 950)) {
-               snprintf(htimbuf, sizeof(htimbuf), TTFMT ".%03dms", t / 1000, 
(int) (t % 1000));
+       (void) sqloptimizer;
+       if (timermode == T_CLOCK){
+               if( t / 1000 < 950) {
+                       snprintf(htimbuf, sizeof(htimbuf), "clk: " TTFMT ".%03d 
ms" , t / 1000, (int) (t % 1000));
+                       return(htimbuf);
+               }
+               t /= 1000;
+               if (t / 1000 < 60) {
+                       snprintf(htimbuf, sizeof(htimbuf), "clk: " TTFMT ".%02d 
sec", t / 1000, (int) ((t % 1000) / 100));
+                       return(htimbuf);
+               }
+               t /= 1000;
+               snprintf(htimbuf, sizeof(htimbuf), "clk: " TTFMT ":%02d min", t 
/ 60, (int) (t % 60));
                return(htimbuf);
        }
-       t /= 1000;
-       if (itimemode == T_SECS || (itimemode == T_HUMAN && t / 1000 < 60)) {
-               snprintf(htimbuf, sizeof(htimbuf), TTFMT ".%ds", t / 1000,
-                               (int) ((t % 1000) / 100));
+       /* for performance measures we use milliseconds as the base */
+       if (timermode == T_PERF){ 
+                       snprintf(htimbuf, sizeof(htimbuf), "clk:%" PRId64 
".%03d sql:%" PRId64 ".%03d opt:%" PRId64 ".%03d run:%" PRId64 ".%03d ms", 
+                       t / 1000, (int)(t % 1000),
+                       sqloptimizer/1000, (int)(sqloptimizer % 1000), 
+                       maloptimizer /1000, (int)(maloptimizer % 1000), 
+                       querytime /1000, (int)(querytime % 1000));
                return(htimbuf);
        }
-       t /= 1000;
-       /* itimemode == T_MINSECS || itimemode == T_HUMAN */
-       snprintf(htimbuf, sizeof(htimbuf), TTFMT "m %ds", t / 60, (int) (t % 
60));
+       htimbuf[0] = 0;
        return(htimbuf);
 }
 
@@ -568,6 +569,10 @@ SQLrow(int *len, int *numeric, char **re
        size_t ulen;
        int *cutafter = malloc(sizeof(int) * fields);
 
+       if (cutafter == NULL){
+               fprintf(stderr,"Malloc for SQLrow failed");
+               exit(2);
+       }
        /* trim the text if needed */
        if (trim == 1) {
                for (i = 0; i < fields; i++) {
@@ -1273,21 +1278,6 @@ TESTrenderer(MapiHdl hdl)
 }
 
 static void
-CLEANrenderer(MapiHdl hdl)
-{
-       char *reply;
-
-       SQLqueryEcho(hdl);
-       while (!mnstr_errnr(toConsole) && (reply = fetch_line(hdl)) != 0) {
-               if (*reply == '%')
-                       continue;
-               if (*reply == '=')
-                       reply++;
-               mnstr_printf(toConsole, "%s\n", reply);
-       }
-}
-
-static void
 RAWrenderer(MapiHdl hdl)
 {
        char *line;
@@ -1301,15 +1291,6 @@ RAWrenderer(MapiHdl hdl)
 }
 
 static void
-TIMERrenderer(MapiHdl hdl, int64_t querytime, int64_t maloptimizertime)
-{
-       SQLqueryEcho(hdl);
-       mapi_next_result(hdl);
-       printf("%s sql:0 opt:%" PRId64 " run:%" PRId64 "\n", timerHuman(),  
maloptimizertime, querytime);
-}
-
-
-static void
 SAMrenderer(MapiHdl hdl)
 {
        /* Variables keeping track of which result set fields map to
@@ -1396,6 +1377,10 @@ SQLheader(MapiHdl hdl, int *len, int fie
                char **names = (char **) malloc(fields * sizeof(char *));
                int *numeric = (int *) malloc(fields * sizeof(int));
 
+               if (names == NULL || numeric == NULL){
+                       fprintf(stderr,"Malloc for SQLheader failed");
+                       exit(2);
+               }
                for (i = 0; i < fields; i++) {
                        names[i] = mapi_get_name(hdl, i);
                        numeric[i] = 0;
@@ -1465,11 +1450,6 @@ SQLrenderer(MapiHdl hdl, char singleinst
 
        /* in case of interactive mode, we should show timing on request */
        singleinstr = showtiming? 1 :singleinstr;
-#if 0
-       if (mark2)
-               free(mark2);
-       mark2 = NULL;
-#endif
 
        croppedfields = 0;
        fields = mapi_get_field_count(hdl);
@@ -1668,13 +1648,7 @@ SQLrenderer(MapiHdl hdl, char singleinst
                SQLseparator(len, printfields, '-');
        rows = mapi_get_row_count(hdl);
        snprintf(buf, sizeof(buf), "%" PRId64 " rows", rows);
-#if 0
-       mark2 = strdup(buf);    /* for the timer output */
-#endif
-       printf("%" PRId64 " tuple%s%s%s%s", rows, rows != 1 ? "s" : "",
-                       singleinstr ? " (" : "",
-                       singleinstr && formatter != TESTformatter ? 
timerHuman() : "",
-                       singleinstr ? ")" : "");
+       printf("%" PRId64 " tuple%s", rows, rows != 1 ? "s" : "");
 
        if (fields != printfields || croppedfields > 0)
                printf(" !");
@@ -1715,8 +1689,6 @@ setFormatter(const char *s)
 #endif
        if (strcmp(s, "sql") == 0) {
                formatter = TABLEformatter;
-       } else if (strcmp(s, "jaql") == 0) {
-               formatter = CLEANformatter;
        } else if (strcmp(s, "csv") == 0) {
                formatter = CSVformatter;
                separator = strdup(",");
@@ -1737,20 +1709,23 @@ setFormatter(const char *s)
                } else
                        separator = strdup(s + 4);
                csvheader = 1;
-       } else if (strcmp(s, "tab") == 0) {
+       } else if (strcmp(s, "tsv") == 0) {
                formatter = CSVformatter;
                separator = strdup("\t");
        } else if (strcmp(s, "raw") == 0) {
                formatter = RAWformatter;
        } else if (strcmp(s, "xml") == 0) {
                formatter = XMLformatter;
+       } else if (strcmp(s, "json") == 0) {
+               formatter = JSONformatter;
        } else if (strcmp(s, "test") == 0) {
 #ifdef _TWO_DIGIT_EXPONENT
                _set_output_format(_TWO_DIGIT_EXPONENT);
 #endif
                formatter = TESTformatter;
-       } else if (strcmp(s, "timer") == 0) {
-               formatter = TIMERformatter;
+               timermode = T_NONE;
+       } else if (strcmp(s, "trash") == 0) {
+               formatter = TRASHformatter;
        } else if (strcmp(s, "sam") == 0) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to