Changeset: 541d31c03a43 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=541d31c03a43
Added Files:
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.sql
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.stable.err
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.stable.out
Modified Files:
        clients/ChangeLog.Mar2018
        clients/Tests/exports.stable.out
        clients/odbc/driver/ODBCDbc.c
        clients/odbc/driver/ODBCDbc.h
        clients/odbc/driver/ODBCStmt.c
        clients/odbc/driver/ODBCStmt.h
        clients/odbc/driver/SQLExecDirect.c
        clients/odbc/driver/SQLExecute.c
        clients/odbc/driver/SQLGetStmtAttr.c
        clients/odbc/driver/SQLSetStmtAttr.c
        configure.ag
        gdk/ChangeLog
        gdk/gdk.h
        gdk/gdk_batop.c
        gdk/gdk_group.c
        gdk/gdk_hash.c
        gdk/gdk_hash.h
        gdk/gdk_imprints.c
        gdk/gdk_join.c
        gdk/gdk_logger.c
        gdk/gdk_orderidx.c
        gdk/gdk_private.h
        gdk/gdk_select.c
        gdk/gdk_unique.c
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_exception.c
        monetdb5/mal/mal_exception.h
        monetdb5/mal/mal_interpreter.c
        monetdb5/modules/atoms/uuid.c
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/tokenizer.c
        sql/backends/monet5/Tests/pyapi09.stable.out
        sql/backends/monet5/Tests/pyapi28.stable.out
        sql/backends/monet5/sql.c
        sql/common/sql_types.c
        sql/server/rel_optimizer.c
        sql/server/sql_atom.c
        sql/server/sql_datetime.c
        sql/server/sql_env.c
        sql/server/sql_env.h
        sql/server/sql_parser.y
        sql/storage/bat/bat_table.c
        
sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err
        sql/test/BugTracker-2018/Tests/All
        testing/exportutils.py
Branch: merge-partitions
Log Message:

Merge with default.


diffs (truncated from 1602 to 300 lines):

diff --git a/clients/ChangeLog.Mar2018 b/clients/ChangeLog.Mar2018
--- a/clients/ChangeLog.Mar2018
+++ b/clients/ChangeLog.Mar2018
@@ -1,3 +1,6 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Tue Jul 24 2018 Sjoerd Mullender <sjo...@acm.org>
+- ODBC: Implemented SQL_ATTR_QUERY_TIMEOUT parameter in SQLSetStmtAttr.
+
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
@@ -112,7 +112,7 @@ BAT *BATconstant(oid hseq, int tt, const
 BAT *BATconvert(BAT *b, BAT *s, int tp, int abort_on_error);
 BUN BATcount_no_nil(BAT *b);
 gdk_return BATdel(BAT *b, BAT *d) __attribute__((__warn_unused_result__));
-BAT *BATdense(oid hseq, oid tseq, BUN cnt) __attribute__((warn_unused_result));
+BAT *BATdense(oid hseq, oid tseq, BUN cnt) 
__attribute__((__warn_unused_result__));
 BAT *BATdiff(BAT *l, BAT *r, BAT *sl, BAT *sr, bool nil_matches, BUN estimate);
 gdk_return BATextend(BAT *b, BUN newcap) 
__attribute__((__warn_unused_result__));
 void BATfakeCommit(BAT *b);
@@ -136,7 +136,7 @@ BAT *BATgroupsum(BAT *b, BAT *g, BAT *e,
 BAT *BATgroupvariance_population(BAT *b, BAT *g, BAT *e, BAT *s, int tp, int 
skip_nils, int abort_on_error);
 BAT *BATgroupvariance_sample(BAT *b, BAT *g, BAT *e, BAT *s, int tp, int 
skip_nils, int abort_on_error);
 BUN BATgrows(BAT *b);
-gdk_return BAThash(BAT *b, BUN masksize);
+gdk_return BAThash(BAT *b);
 void BAThseqbase(BAT *b, oid o);
 gdk_return BATimprints(BAT *b);
 BAT *BATintersect(BAT *l, BAT *r, BAT *sl, BAT *sr, bool nil_matches, BUN 
estimate);
@@ -206,7 +206,7 @@ gdk_return BUNdelete(BAT *b, oid o) __at
 BUN BUNfnd(BAT *b, const void *right);
 gdk_return BUNinplace(BAT *b, BUN p, const void *right, bool force) 
__attribute__((__warn_unused_result__));
 BAT *COLcopy(BAT *b, int tt, bool writable, int role);
-BAT *COLnew(oid hseq, int tltype, BUN capacity, int role) 
__attribute__((warn_unused_result));
+BAT *COLnew(oid hseq, int tltype, BUN capacity, int role) 
__attribute__((__warn_unused_result__));
 size_t GDK_mem_maxsize;
 size_t GDK_vm_maxsize;
 int GDK_vm_trim;
@@ -248,7 +248,7 @@ MT_Lock *volatile GDKlocklist;
 ATOMIC_FLAG volatile GDKlocklistlock;
 ATOMIC_TYPE volatile GDKlocksleepcnt;
 void GDKlockstatistics(int);
-void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
 size_t GDKmem_cursize(void);
 gdk_return GDKmergeidx(BAT *b, BAT **a, int n_ar);
 void *GDKmmap(const char *path, int mode, size_t len);
@@ -258,7 +258,7 @@ int GDKnr_threads;
 void GDKprepareExit(void);
 void GDKqsort(void *restrict h, void *restrict t, const void *restrict base, 
size_t n, int hs, int ts, int tpe);
 void GDKqsort_rev(void *restrict h, void *restrict t, const void *restrict 
base, size_t n, int hs, int ts, int tpe);
-void *GDKrealloc(void *pold, size_t size) 
__attribute__((__warn_unused_result__));
+void *GDKrealloc(void *pold, size_t size) __attribute__((__alloc_size__(2))) 
__attribute__((__warn_unused_result__));
 void GDKregister(MT_Id pid);
 gdk_return GDKreleasemmap(void *ptr, size_t size, size_t id, str *msg);
 gdk_return GDKreleasesem(int sem_id, str *msg);
@@ -276,7 +276,7 @@ lng GDKusec(void);
 BAT *GDKval;
 const char *GDKversion(void);
 size_t GDKvm_cursize(void);
-void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
 void HASHdestroy(BAT *b);
 BUN HASHlist(Hash *h, BUN i);
 BUN HASHprobe(const Hash *h, const void *v);
@@ -2053,8 +2053,8 @@ str copy_fromRef;
 str countRef;
 str count_no_nilRef;
 int cpyConstant(MalBlkPtr mb, VarPtr vr);
-str createException(enum malexception, const char *, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
3, 4)));
-str createMalException(MalBlkPtr, int, enum malexception, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
4, 5)));
+str createException(enum malexception, const char *, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
3, 4))) __attribute__((__returns_nonnull__));
+str createMalException(MalBlkPtr, int, enum malexception, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
4, 5))) __attribute__((__returns_nonnull__));
 str createRef;
 str create_constraintRef;
 str create_functionRef;
diff --git a/clients/odbc/driver/ODBCDbc.c b/clients/odbc/driver/ODBCDbc.c
--- a/clients/odbc/driver/ODBCDbc.c
+++ b/clients/odbc/driver/ODBCDbc.c
@@ -76,6 +76,7 @@ newODBCDbc(ODBCEnv *env)
        dbc->minor = 0;
        dbc->patch = 0;
        dbc->cachelimit = 0;
+       dbc->qtimeout = 0;
        dbc->Mdebug = 0;
 
        dbc->FirstStmt = NULL;
diff --git a/clients/odbc/driver/ODBCDbc.h b/clients/odbc/driver/ODBCDbc.h
--- a/clients/odbc/driver/ODBCDbc.h
+++ b/clients/odbc/driver/ODBCDbc.h
@@ -62,6 +62,7 @@ typedef struct tODBCDRIVERDBC {
        /* MonetDB connection handle & status information */
        Mapi mid;               /* connection with server */
        int cachelimit;         /* cache limit we requested */
+       SQLULEN qtimeout;       /* current query timeout */
        short major, minor, patch; /* version of server */
        int Mdebug;
 
diff --git a/clients/odbc/driver/ODBCStmt.c b/clients/odbc/driver/ODBCStmt.c
--- a/clients/odbc/driver/ODBCStmt.c
+++ b/clients/odbc/driver/ODBCStmt.c
@@ -76,6 +76,8 @@ newODBCStmt(ODBCDbc *dbc)
        stmt->querytype = -1;
        stmt->rowcount = 0;
 
+       stmt->qtimeout = dbc->qtimeout; /* inherit query timeout */
+
        /* add this stmt to the administrative linked stmt list */
        stmt->next = dbc->FirstStmt;
        dbc->FirstStmt = stmt;
diff --git a/clients/odbc/driver/ODBCStmt.h b/clients/odbc/driver/ODBCStmt.h
--- a/clients/odbc/driver/ODBCStmt.h
+++ b/clients/odbc/driver/ODBCStmt.h
@@ -80,6 +80,8 @@ typedef struct tODBCDRIVERSTMT {
 
        int querytype;          /* query type as returned by server */
 
+       SQLULEN qtimeout;       /* query timeout requested */
+
        SQLUINTEGER cursorType;
        SQLULEN cursorScrollable;
        SQLULEN retrieveData;
diff --git a/clients/odbc/driver/SQLExecDirect.c 
b/clients/odbc/driver/SQLExecDirect.c
--- a/clients/odbc/driver/SQLExecDirect.c
+++ b/clients/odbc/driver/SQLExecDirect.c
@@ -46,6 +46,14 @@ ODBCExecDirect(ODBCStmt *stmt, SQLCHAR *
                return SQL_ERROR;
        }
 
+       if (stmt->qtimeout != stmt->Dbc->qtimeout) {
+               char buf[48];
+               snprintf(buf, sizeof(buf), "call sys.settimeout(%" PRIu64 ")",
+                        (uint64_t) stmt->qtimeout);
+               if (mapi_query_handle(hdl, buf) == MOK)
+                       stmt->Dbc->qtimeout = stmt->qtimeout;
+       }
+
        query = ODBCTranslateSQL(stmt->Dbc, StatementText, (size_t) TextLength,
                                 stmt->noScan);
        if (query == NULL) {
diff --git a/clients/odbc/driver/SQLExecute.c b/clients/odbc/driver/SQLExecute.c
--- a/clients/odbc/driver/SQLExecute.c
+++ b/clients/odbc/driver/SQLExecute.c
@@ -447,6 +447,12 @@ MNDBExecute(ODBCStmt *stmt)
                addStmtError(stmt, "HY001", NULL, 0);
                return SQL_ERROR;
        }
+       if (stmt->qtimeout != stmt->Dbc->qtimeout) {
+               snprintf(query, querylen, "call sys.settimeout(%" PRIu64 ")",
+                        (uint64_t) stmt->qtimeout);
+               if (mapi_query_handle(hdl, query) == MOK)
+                       stmt->Dbc->qtimeout = stmt->qtimeout;
+       }
        querypos = snprintf(query, querylen, "execute %d (", stmt->queryid);
        /* XXX fill in parameter values */
        if (desc->sql_desc_bind_offset_ptr)
diff --git a/clients/odbc/driver/SQLGetStmtAttr.c 
b/clients/odbc/driver/SQLGetStmtAttr.c
--- a/clients/odbc/driver/SQLGetStmtAttr.c
+++ b/clients/odbc/driver/SQLGetStmtAttr.c
@@ -123,7 +123,7 @@ MNDBGetStmtAttr(ODBCStmt *stmt,
                                        BufferLength, StringLengthPtr);
        case SQL_ATTR_QUERY_TIMEOUT:            /* SQLULEN */
                /* SQL_QUERY_TIMEOUT */
-               WriteData(ValuePtr, 0, SQLULEN);
+               WriteData(ValuePtr, stmt->qtimeout, SQLULEN);
                break;
        case SQL_ATTR_RETRIEVE_DATA:            /* SQLULEN */
                /* SQL_RETRIEVE_DATA */
diff --git a/clients/odbc/driver/SQLSetStmtAttr.c 
b/clients/odbc/driver/SQLSetStmtAttr.c
--- a/clients/odbc/driver/SQLSetStmtAttr.c
+++ b/clients/odbc/driver/SQLSetStmtAttr.c
@@ -195,6 +195,14 @@ MNDBSetStmtAttr(ODBCStmt *stmt,
                return MNDBSetDescField(stmt->ApplParamDescr, 0,
                                        SQL_DESC_ARRAY_SIZE, ValuePtr,
                                        StringLength);
+       case SQL_ATTR_QUERY_TIMEOUT:            /* SQLULEN */
+               if ((uintptr_t) ValuePtr > 0x7FFFFFFF) {
+                       stmt->qtimeout = 0x7FFFFFFF;
+                       addStmtError(stmt, "01S02", NULL, 0);
+               } else {
+                       stmt->qtimeout = (SQLULEN) (uintptr_t) ValuePtr;
+               }
+               break;
        case SQL_ATTR_RETRIEVE_DATA:            /* SQLULEN */
                switch ((SQLULEN) (uintptr_t) ValuePtr) {
                case SQL_RD_ON:
@@ -280,7 +288,6 @@ MNDBSetStmtAttr(ODBCStmt *stmt,
        case SQL_ATTR_CURSOR_SENSITIVITY:       /* SQLULEN */
        case SQL_ATTR_FETCH_BOOKMARK_PTR:       /* SQLLEN* */
        case SQL_ATTR_KEYSET_SIZE:              /* SQLULEN */
-       case SQL_ATTR_QUERY_TIMEOUT:            /* SQLULEN */
        case SQL_ATTR_SIMULATE_CURSOR:          /* SQLULEN */
        case SQL_ATTR_USE_BOOKMARKS:            /* SQLULEN */
                /* Optional feature not implemented */
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -735,6 +735,12 @@ AS_VAR_IF([enable_sanitizer], [no], [], 
 AC_SUBST([CFLAGS])
 AC_SUBST([X_CFLAGS])
 
+# see https://software.intel.com/en-us/forums/intel-c-compiler/topic/760979
+AS_CASE([$CC_ver], [icc-*], [
+       AS_IF([test -f /usr/include/math.h && ! grep -q _LIB_VERSION_TYPE 
/usr/include/math.h],
+               [AC_DEFINE([INTEL_MATH_H_HACK], 1,
+                       [Define if using Intel compiler with icompatible system 
math.h])])])
+
 AC_MSG_CHECKING([for ld -Bsymbolic-functions option])
 save_LDFLAGS="$LDFLAGS"
 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
@@ -2920,6 +2926,17 @@ AH_TOP([
 @%:@define _SEEN_MONETDB_CONFIG_H 1
 ])
 AH_BOTTOM([
+@%:@ifdef INTEL_MATH_H_HACK
+/* see https://software.intel.com/en-us/forums/intel-c-compiler/topic/760979 */
+typedef enum {
+       _IEEE_ = -1,    /* According to IEEE 754/IEEE 854.  */
+       _SVID_,         /* According to System V, release 4.  */
+       _XOPEN_,        /* Nowadays also Unix98.  */
+       _POSIX_,
+       _ISOC_          /* Actually this is ISO C99.  */
+} _LIB_VERSION_TYPE;
+@%:@endif
+
 @%:@ifdef HAVE_SYS_TYPES_H
 @%:@ include <sys/types.h>
 @%:@endif
@@ -2945,20 +2962,6 @@ typedef __uint128_t uhge;
 @%:@define SIZEOF_HGE SIZEOF___INT128_T
 @%:@endif
 
-/* defines to help the compiler check printf-style format arguments */
-@%:@if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ 
< 5)
-/* This feature is available in gcc versions 2.5 and later.  */
-@%:@ ifndef __attribute__
-@%:@  define __attribute__(Spec) /* empty */
-@%:@ endif
-@%:@else
-/* The __-protected variants of `format' and `printf' attributes are
- * accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-@%:@ if !defined(__format__) && (__GNUC__ < 2 || (__GNUC__ == 2 && 
__GNUC_MINOR__ < 7))
-@%:@  define __format__ format
-@%:@  define __printf__ printf
-@%:@ endif
-@%:@endif
 @%:@if !defined(_MSC_VER) && !defined(_In_z_)
 @%:@ define _In_z_
 @%:@ define _Printf_format_string_
diff --git a/gdk/ChangeLog b/gdk/ChangeLog
--- a/gdk/ChangeLog
+++ b/gdk/ChangeLog
@@ -1,6 +1,9 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Tue Jul 24 2018 Sjoerd Mullender <sjo...@acm.org>
+- Removed "masksize" argument of function BAThash.
+
 * Tue May 29 2018 Sjoerd Mullender <sjo...@acm.org>
 - A whole bunch of functions that took an int argument that was used as a
   Boolean (true/false) value now take a value of type bool.  The functions
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -335,6 +335,29 @@
 #include "gdk_posix.h"
 #include "stream.h"
 
+/* if __has_attribute is not known to the preprocessor, we ignore
+ * attributes completely; if it is known, use it to find out whether
+ * specific attributes that we use are known */
+#ifndef __has_attribute
+#define __has_attribute(attr)  0
+#define __attribute__(attr)    /* empty */
+#endif
+#if !__has_attribute(__warn_unused_result__)
+#define __warn_unused_result__
+#endif
+#if !__has_attribute(__malloc__)
+#define __malloc__
+#endif
+#if !__has_attribute(__alloc_size__)
+#define __alloc_size__(a)
+#endif
+#if !__has_attribute(__format__)
+#define __format__(a,b,c)
+#endif
+#if !__has_attribute(__noreturn__)
+#define __noreturn__
+#endif
+
 #undef MIN
 #undef MAX
 #define MAX(A,B)       ((A)<(B)?(B):(A))
@@ -885,7 +908,7 @@ typedef struct BATiter {
  * isolate you from the different ways heaps can be accessed.
  */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to