Changeset: a3f790992cb4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a3f790992cb4
Added Files:
        sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.sql
        sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.err
        sql/test/BugTracker-2017/Tests/cleanup_statistics.Bug-6439.stable.out
        sql/test/mergetables/Tests/sqlsmith.Bug-6472.sql
        sql/test/mergetables/Tests/sqlsmith.Bug-6472.stable.err
        sql/test/mergetables/Tests/sqlsmith.Bug-6472.stable.out
Modified Files:
        NT/monetdb_config.h.in
        clients/Tests/exports.stable.out
        clients/mapiclient/mclient.c
        clients/mapilib/mapi.c
        clients/mapilib/mapi.h
        clients/odbc/driver/ODBCConvert.c
        common/stream/stream.c
        common/stream/stream.h
        configure.ag
        gdk/gdk.h
        gdk/gdk_align.c
        gdk/gdk_atoms.c
        gdk/gdk_atoms.h
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_group.c
        gdk/gdk_hash.c
        gdk/gdk_hash.h
        gdk/gdk_heap.c
        gdk/gdk_imprints.c
        gdk/gdk_orderidx.c
        gdk/gdk_private.h
        gdk/gdk_project.c
        gdk/gdk_storage.c
        gdk/gdk_unique.c
        gdk/gdk_utils.c
        monetdb5/mal/mal_atom.c
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_import.c
        monetdb5/mal/mal_resource.h
        monetdb5/mal/mal_session.c
        monetdb5/modules/atoms/inet.c
        monetdb5/modules/atoms/url.c
        monetdb5/modules/kernel/alarm.c
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/kernel/status.c
        monetdb5/modules/mal/bbp.c
        monetdb5/modules/mal/calc.c
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/inspect.c
        monetdb5/modules/mal/language.c
        monetdb5/modules/mal/mal_io.c
        monetdb5/modules/mal/mdb.c
        monetdb5/modules/mal/orderidx.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/remote.c
        monetdb5/modules/mal/remote.h
        monetdb5/modules/mal/sabaoth.c
        monetdb5/optimizer/opt_support.c
        sql/backends/monet5/Tests/cfunction03.sql
        sql/backends/monet5/UDF/pyapi/convert_loops.h
        sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_result.c
        sql/backends/monet5/sql_result.h
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/vaults/bam/Tests/query2.1.stable.out
        sql/backends/monet5/vaults/bam/Tests/query2.10.stable.out
        sql/backends/monet5/vaults/bam/Tests/query2.2.stable.out
        sql/backends/monet5/vaults/bam/Tests/query2.2.stable.out.int128
        sql/backends/monet5/vaults/bam/bam_wrapper.c
        sql/backends/monet5/vaults/lidar/lidar.c
        sql/common/sql_mem.c
        sql/common/sql_types.h
        sql/include/sql_mem.h
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_optimizer.c
        sql/server/rel_rel.c
        sql/server/rel_select.c
        sql/server/sql_atom.c
        sql/server/sql_atom.h
        sql/server/sql_mvc.c
        sql/server/sql_mvc.h
        sql/storage/store.c
        sql/test/BugTracker-2012/Tests/currenttime.Bug-2781.SQL.py
        
sql/test/BugTracker-2012/Tests/scalar_subquery_with_alias.Bug-3093.stable.out
        
sql/test/BugTracker-2016/Tests/nested-subquery-in-select.Bug-6125.stable.out
        sql/test/BugTracker-2017/Tests/All
        
sql/test/BugTracker-2017/Tests/crash_on_count_div_count.Bug-6201.stable.out
        sql/test/BugTracker-2017/Tests/oidx-on-strings.Bug-6202.stable.err
        
sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.stable.err
        
sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.stable.out
        sql/test/Tests/marcin1.stable.out
        sql/test/mergetables/Tests/All
        sql/test/orderidx/Tests/oidx_all_types.stable.err
        sql/test/orderidx/Tests/oidx_all_types.stable.out
        testing/Mtest.py.in
        tools/merovingian/daemon/forkmserver.c
Branch: trails
Log Message:

Merged with default


diffs (truncated from 6636 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -51,6 +51,32 @@
 #include <stdio.h>             /* NULL, printf etc. */
 #include <errno.h>
 #include <stdarg.h>            /* va_alist.. */
+#if !defined(_MSC_VER) || _MSC_VER >= 1800
+#include <inttypes.h>
+#include <stdbool.h>
+#else
+#error old versions of Visual Studio are no longer supported
+/* ... but this is how you might be able to do it (untested) */
+#if !defined(_MSC_VER) || _MSC_VER >= 1600
+/* old Visual Studio */
+#include <stdint.h>
+#else
+/* ancient Visual Studio */
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned __int64 uint64_t;
+typedef int64_t __int64;
+typedef uint64_t unsigned __int64;
+#endif
+/* normally defined in inttypes.h */
+#define PRId64 "I64d"
+#define PRIu64 "I64u"
+/* normally defined in stdbool.h */
+#define true 1
+#define false 0
+#define __bool_true_false_are_defined 1
+#endif
 
 #include <assert.h>
 
@@ -218,11 +244,6 @@
 /* Define to 1 if you have the <ieeefp.h> header file. */
 /* #undef HAVE_IEEEFP_H */
 
-/* Define to 1 if you have the <inttypes.h> header file. */
-#if !defined(_MSC_VER) || _MSC_VER >= 1800
-#define HAVE_INTTYPES_H 1
-#endif
-
 /* Define to 1 if you have the <io.h> header file. */
 #define HAVE_IO_H 1
 
@@ -987,29 +1008,13 @@ c99_snprintf(char *outBuf, size_t size, 
 #define va_copy(x,y) ((x) = (y))
 #endif
 
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned __int64 uint64_t;
-
-/* normally defined in stdbool.h, but that doesn't exist on Windows */
-#define true 1
-#define false 0
-#define __bool_true_false_are_defined 1
-
 /* normally defined in fcntl.h, but not on Windows */
 #define O_CLOEXEC 0
 
 
-#ifdef HAVE_LONG_LONG
-typedef long long lng;
-typedef unsigned long long ulng;
-# define SIZEOF_LNG SIZEOF_LONG_LONG
-#else
-typedef __int64 lng;
-typedef unsigned __int64 ulng;
-# define SIZEOF_LNG SIZEOF___INT64
-#endif
+typedef int64_t lng;
+typedef uint64_t ulng;
+#define SIZEOF_LNG 8
 
 #ifdef HAVE___INT128
 typedef __int128 hge;
@@ -1026,10 +1031,10 @@ typedef __uint128_t uhge;
 #endif
 
 /* Format to print 64 bit signed integers. */
-#define LLFMT "%I64d"
+#define LLFMT "%" PRId64
 
 /* Format to print 64 bit unsigned integers. */
-#define ULLFMT "%I64u"
+#define ULLFMT "%" PRIu64
 
 /* define printf formats for printing size_t and ssize_t variables */
 #if SIZEOF_SIZE_T == SIZEOF_INT
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
@@ -189,9 +189,7 @@ bat BBPindex(const char *nme);
 void BBPkeepref(bat i);
 bat BBPlimit;
 void BBPlock(void);
-str BBPlogical(bat b, str buf);
 int BBPout;
-str BBPphysical(bat b, str buf);
 BAT *BBPquickdesc(bat b, int delaccess);
 int BBPreclaim(BAT *b);
 int BBPrelease(bat b);
@@ -266,7 +264,7 @@ gdk_return GDKreleasesem(int sem_id, str
 void GDKreset(int status, int exit);
 gdk_return GDKsetenv(const char *name, const char *value);
 void GDKsetmallocsuccesscount(lng count);
-ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, ssize_t 
len);
+ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char 
*restrict src, ssize_t len);
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
 void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
@@ -385,8 +383,8 @@ int dlclose(void *handle);
 char *dlerror(void);
 void *dlopen(const char *file, int mode);
 void *dlsym(void *handle, const char *name);
-size_t escapedStr(char *dst, const char *src, size_t dstlen, const char *sep1, 
const char *sep2, int quote);
-size_t escapedStrlen(const char *src, const char *sep1, const char *sep2, int 
quote);
+size_t escapedStr(char *restrict dst, const char *restrict src, size_t dstlen, 
const char *sep1, const char *sep2, int quote);
+size_t escapedStrlen(const char *restrict src, const char *sep1, const char 
*sep2, int quote);
 ssize_t fltFromStr(const char *src, size_t *len, flt **dst);
 ssize_t fltToStr(str *dst, size_t *len, const flt *src);
 NANCONST flt flt_nil;
@@ -480,7 +478,7 @@ void rewinddir(DIR *dir);
 ssize_t shtFromStr(const char *src, size_t *len, sht **dst);
 ssize_t shtToStr(str *dst, size_t *len, const sht *src);
 const sht sht_nil;
-ssize_t strFromStr(const char *src, size_t *len, str *dst);
+ssize_t strFromStr(const char *restrict src, size_t *restrict len, str 
*restrict dst);
 BUN strHash(const char *s);
 size_t strLen(const char *s);
 int strNil(const char *s);
@@ -530,6 +528,7 @@ char *mapi_get_host(Mapi mid);
 char *mapi_get_lang(Mapi mid);
 int64_t mapi_get_last_id(MapiHdl hdl);
 int mapi_get_len(MapiHdl hdl, int fnr);
+int64_t mapi_get_maloptimizertime(MapiHdl hdl);
 char *mapi_get_mapi_version(Mapi mid);
 char *mapi_get_monet_version(Mapi mid);
 char *mapi_get_motd(Mapi mid);
@@ -2658,8 +2657,8 @@ int mnstr_isalive(stream *s);
 char *mnstr_name(stream *s);
 int mnstr_printf(stream *restrict s, _In_z_ _Printf_format_string_ const char 
*restrict format, ...) __attribute__((__format__(__printf__, 2, 3)));
 ssize_t mnstr_read(stream *restrict s, void *restrict buf, size_t elmsize, 
size_t cnt);
-int mnstr_readBte(stream *restrict s, signed char *restrict val);
-int mnstr_readBteArray(stream *restrict s, signed char *restrict val, size_t 
cnt);
+int mnstr_readBte(stream *restrict s, int8_t *restrict val);
+int mnstr_readBteArray(stream *restrict s, int8_t *restrict val, size_t cnt);
 int mnstr_readChr(stream *restrict s, char *restrict val);
 int mnstr_readHge(stream *restrict s, hge *restrict val);
 int mnstr_readHgeArray(stream *restrict s, hge *restrict val, size_t cnt);
@@ -2676,8 +2675,8 @@ void mnstr_set_byteorder(stream *s, char
 void mnstr_settimeout(stream *s, unsigned int ms, int( *func)(void));
 int mnstr_type(stream *s);
 ssize_t mnstr_write(stream *restrict s, const void *restrict buf, size_t 
elmsize, size_t cnt);
-int mnstr_writeBte(stream *s, signed char val);
-int mnstr_writeBteArray(stream *restrict s, const signed char *restrict val, 
size_t cnt);
+int mnstr_writeBte(stream *s, int8_t val);
+int mnstr_writeBteArray(stream *restrict s, const int8_t *restrict val, size_t 
cnt);
 int mnstr_writeChr(stream *s, char val);
 int mnstr_writeDbl(stream *s, double val);
 int mnstr_writeFlt(stream *s, float val);
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1301,11 +1301,11 @@ RAWrenderer(MapiHdl hdl)
 }
 
 static void
-TIMERrenderer(MapiHdl hdl, int64_t querytime)
+TIMERrenderer(MapiHdl hdl, int64_t querytime, int64_t maloptimizertime)
 {
        SQLqueryEcho(hdl);
        mapi_next_result(hdl);
-       printf("%" PRId64 " %s\n", querytime, timerHuman());
+       printf("%s sql:0 opt:%" PRId64 " run:%" PRId64 "\n", timerHuman(),  
maloptimizertime, querytime);
 }
 
 
@@ -1827,6 +1827,7 @@ format_result(Mapi mid, MapiHdl hdl, cha
        int64_t aff, lid;
        char *reply;
        int64_t querytime;
+       int64_t maloptimizer;
 #ifdef HAVE_POPEN
        stream *saveFD;
 
@@ -1860,12 +1861,13 @@ format_result(Mapi mid, MapiHdl hdl, cha
                        continue;
                case Q_UPDATE:
                        querytime = mapi_get_querytime(hdl);
+                       maloptimizer = mapi_get_maloptimizertime(hdl);
                        SQLqueryEcho(hdl);
                        if (formatter == RAWformatter ||
                            formatter == TESTformatter)
                                mnstr_printf(toConsole, "[ %" PRId64 "\t]\n", 
mapi_rows_affected(hdl));
                        else if (formatter == TIMERformatter)
-                               printf("%" PRId64 " %s\n", querytime, 
timerHuman());
+                               TIMERrenderer(hdl, querytime, maloptimizer);
                        else {
                                aff = mapi_rows_affected(hdl);
                                lid = mapi_get_last_id(hdl);
@@ -1887,6 +1889,7 @@ format_result(Mapi mid, MapiHdl hdl, cha
                        continue;
                case Q_SCHEMA:
                        querytime = mapi_get_querytime(hdl);
+                       maloptimizer = mapi_get_maloptimizertime(hdl);
                        SQLqueryEcho(hdl);
                        if (formatter == TABLEformatter) {
                                mnstr_printf(toConsole, "operation successful");
@@ -1895,7 +1898,7 @@ format_result(Mapi mid, MapiHdl hdl, cha
                                                     timerHuman());
                                mnstr_printf(toConsole, "\n");
                        } else if (formatter == TIMERformatter)
-                               printf("%" PRId64 " %s\n", querytime, 
timerHuman());
+                               TIMERrenderer(hdl, querytime, maloptimizer);
                        continue;
                case Q_TRANS:
                        SQLqueryEcho(hdl);
@@ -1914,6 +1917,7 @@ format_result(Mapi mid, MapiHdl hdl, cha
                        break;
                case Q_TABLE:
                        querytime = mapi_get_querytime(hdl);
+                       maloptimizer = mapi_get_maloptimizertime(hdl);
                        break;
                default:
                        if (formatter == TABLEformatter && specials != 
DEBUGmodifier) {
@@ -1974,7 +1978,7 @@ format_result(Mapi mid, MapiHdl hdl, cha
                                }
                                break;
                        case TIMERformatter:
-                               TIMERrenderer(hdl, querytime);
+                               TIMERrenderer(hdl, querytime, maloptimizer);
                                break;
                        case SAMformatter:
                                SAMrenderer(hdl);
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -885,6 +885,7 @@ struct MapiResultSet {
        int64_t row_count;
        int64_t last_id;
        int64_t querytime;
+       int64_t maloptimizertime;
        int fieldcnt;
        int maxfields;
        char *errorstr;         /* error from server */
@@ -1450,6 +1451,7 @@ new_result(MapiHdl hdl)
        result->querytype = -1;
        result->errorstr = NULL;
        result->querytime = 0;
+       result->maloptimizertime = 0;
        memset(result->sqlstate, 0, sizeof(result->sqlstate));
 
        result->tuple_count = 0;
@@ -3759,6 +3761,7 @@ parse_header_line(MapiHdl hdl, char *lin
                result->querytype = qt;
                result->commentonly = 0;
                result->querytime = 0;
+               result->maloptimizertime = 0;
 
                nline++;        /* skip space */
                switch (qt) {
@@ -3776,13 +3779,16 @@ parse_header_line(MapiHdl hdl, char *lin
                        result->last_id = strtoll(nline, &nline, 10);
                        queryid = strtoll(nline, &nline, 10);
                        result->querytime = strtoll(nline, &nline, 10);
+                       result->maloptimizertime = strtoll(nline, &nline, 10);
                        break;
                case Q_TABLE:
-                       if (sscanf(nline, "%d %" SCNd64 " %d %" SCNd64 " %" 
SCNu64 " %" SCNd64,
+                       if (sscanf(nline, "%d %" SCNd64 " %d %" SCNd64 " %" 
SCNu64 " %" SCNd64 " %" SCNd64,
                                   &result->tableid, &result->row_count,
                                   &result->fieldcnt, &result->tuple_count,
-                                  &queryid, &result->querytime) < 6)
-                               result->querytime = 0;
+                                  &queryid, &result->querytime, 
&result->maloptimizertime) < 7){
+                                       result->querytime = 0;
+                                       result->maloptimizertime = 0;
+                               }
                        (void) queryid; /* ignored for now */
                        break;
                case Q_PREPARE:
@@ -5311,6 +5317,17 @@ mapi_get_querytime(MapiHdl hdl)
        return result->querytime;
 }
 
+int64_t
+mapi_get_maloptimizertime(MapiHdl hdl)
+{
+       struct MapiResultSet *result;
+
+       mapi_hdl_check(hdl, "mapi_get_maloptimizertime");
+       if ((result = hdl->result) == NULL)
+               return 0;
+       return result->maloptimizertime;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to