Changeset: 2e26fb1ae104 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2e26fb1ae104
Modified Files:
        clients/Tests/exports.stable.out
Branch: embedded_mapi
Log Message:

Merge with default.


diffs (truncated from 4106 to 300 lines):

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
@@ -1447,6 +1447,7 @@ char *monetdbe_error(monetdbe_database d
 char *monetdbe_execute(monetdbe_statement *stmt, monetdbe_result **result, 
monetdbe_cnt *affected_rows);
 char *monetdbe_get_autocommit(monetdbe_database dbhdl, int *result);
 char *monetdbe_get_columns(monetdbe_database dbhdl, const char *schema_name, 
const char *table_name, size_t *column_count, monetdbe_column **columns);
+const char *monetdbe_get_mapi_port(void);
 int monetdbe_in_transaction(monetdbe_database dbhdl);
 const void *monetdbe_null(monetdbe_database dbhdl, monetdbe_types t);
 int monetdbe_open(monetdbe_database *db, char *url, monetdbe_options *opts);
diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -424,7 +424,7 @@ SQLhelp sqlhelp1[] = {
         "",
         "[ WITH cte_list ] MERGE INTO qname [ [AS] ident ] USING table_ref [ 
[AS] ident ] ON search_condition merge_list",
         "cte_list,table_ref,search_condition,merge_list",
-        "See also: 
https://www.monetdb.org/blog/sql2003_merge_statements_now_supported"},
+        "See also: 
https://www.monetdb.org/documentation/user-guide/blog-archive/merge-statements/"},
        {"PLAN",
         "Give relational execution plan for the SQL statement",
         "PLAN statement",
@@ -761,14 +761,14 @@ SQLhelp sqlhelp2[] = {
         NULL,
         "PARTITION BY { RANGE | VALUES } { ON '(' ident ')' | USING '(' 
query_expression ')' }",
         "query_expression",
-        "See also: https://www.monetdb.org/blog/updatable-merge-tables"},
+        "See also: 
https://www.monetdb.org/documentation/user-guide/blog-archive/update-mergetables/"},
        {"partition_spec",
         NULL,
         "{ IN '(' partition_list ')' [ WITH NULL VALUES ]\n"
         "| FROM partition_range_from TO partition_range_to [ WITH NULL VALUES 
]\n"
         "| FOR NULL VALUES }",
         "partition_list,partition_range_from,partition_range_to",
-        "See also: https://www.monetdb.org/blog/updatable-merge-tables"},
+        "See also: 
https://www.monetdb.org/documentation/user-guide/blog-archive/update-mergetables/"},
        {"param",
         NULL,
         "ident data_type",
diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake
--- a/cmake/monetdb-options.cmake
+++ b/cmake/monetdb-options.cmake
@@ -69,6 +69,10 @@ option(SANITIZER
   "Enable support for the GCC address sanitizer (default=OFF)"
   OFF)
 
+option(UNDEFINED
+  "Enable support for the GCC undefined sanitizer (default=OFF)"
+  OFF)
+
 option(STRICT
   "Enable strict compiler flags (default=ON for development sources, OFF for 
tarball installation)"
   "${DEVELOPMENT}")
diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake
--- a/cmake/monetdb-toolchain.cmake
+++ b/cmake/monetdb-toolchain.cmake
@@ -30,6 +30,21 @@ function(monetdb_default_compiler_option
     endif()
   endif()
 
+  if(UNDEFINED)
+    if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
+      add_compile_options("-fsanitize=undefined")
+      add_compile_options("-fno-omit-frame-pointer")
+      add_compile_definitions(UNDEFINED)
+      if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
+        add_link_options("-fsanitize=undefined")
+      else()
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined" PARENT_SCOPE)
+      endif()
+    else()
+      message(FATAL_ERROR "Sanitizer only supported with GCC")
+    endif()
+  endif()
+
   if(STRICT)
     if(${CMAKE_C_COMPILER_ID} MATCHES "^(GNU|Clang|AppleClang)$")
       add_compile_options("-Werror")
diff --git a/common/stream/text_stream.c b/common/stream/text_stream.c
--- a/common/stream/text_stream.c
+++ b/common/stream/text_stream.c
@@ -166,7 +166,8 @@ text_pump_out(inner_state_t *ist, pump_a
        size_t dst_count = ist->dst_win.count;
        size_t ncopy = src_count < dst_count ? src_count : dst_count;
 
-       memcpy(ist->dst_win.start, ist->src_win.start, ncopy);
+       if (ncopy > 0)
+               memcpy(ist->dst_win.start, ist->src_win.start, ncopy);
        ist->dst_win.start += ncopy;
        ist->dst_win.count -= ncopy;
        ist->src_win.start += ncopy;
diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -40,6 +40,8 @@ GDKrebuild_segment_tree(oid ncount, oid 
 
        *nlevels = next_levels; /* set the logical size of levels before the 
physical one */
        next_tree_size *= data_size;
+       /* round up to multiple of sizeof(oid) */
+       next_tree_size = ((next_tree_size + SIZEOF_OID - 1) / SIZEOF_OID) * 
SIZEOF_OID;
        total_size = next_tree_size + next_levels * sizeof(oid);
 
        if (total_size > BATcount(st)) {
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -554,7 +554,7 @@ append_msk_bat(BAT *b, BAT *n, struct ca
                                        *bp++ |= (*np & mask) << boff;
                                        cnt -= 32;
                                }
-                               if (cnt > boff) {
+                               if (cnt > noff) {
                                        /* the last bits come from two words
                                         * in n */
                                        *bp = (*np++ & ~mask) >> noff;
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1160,6 +1160,30 @@ scanselect(BAT *b, BATiter *bi, struct c
                /* in the case where equi==true, the check is x == *tl */ \
        } while (false)
 
+#if SIZEOF_BUN == SIZEOF_INT
+#define CALC_ESTIMATE(TPE)                                             \
+       do {                                                            \
+               if (*(TPE*)tl < 1) {                                    \
+                       if ((int) BUN_MAX + *(TPE*)tl >= *(TPE*)th)     \
+                               estimate = (BUN) ((int) *(TPE*)th - *(TPE*)tl); 
\
+               } else {                                                \
+                       if (-(int) BUN_MAX + *(TPE*)tl <= *(TPE*)th)    \
+                               estimate = (BUN) ((int) *(TPE*)th - *(TPE*)tl); 
\
+               }                                                       \
+       } while (0)
+#else
+#define CALC_ESTIMATE(TPE)                                             \
+       do {                                                            \
+               if (*(TPE*)tl < 1) {                                    \
+                       if ((lng) BUN_MAX + *(TPE*)tl >= *(TPE*)th)     \
+                               estimate = (BUN) ((lng) *(TPE*)th - *(TPE*)tl); 
\
+               } else {                                                \
+                       if (-(lng) BUN_MAX + *(TPE*)tl <= *(TPE*)th)    \
+                               estimate = (BUN) ((lng) *(TPE*)th - *(TPE*)tl); 
\
+               }                                                       \
+       } while (0)
+#endif
+
 /* generic range select
  *
  * Return a BAT with the OID values of b for qualifying tuples.  The
@@ -1874,19 +1898,18 @@ BATselect(BAT *b, BAT *s, const void *tl
                                estimate = (BUN) (*(sht *) th - *(sht *) tl);
                                break;
                        case TYPE_int:
-                               estimate = (BUN) (*(int *) th - *(int *) tl);
+                               CALC_ESTIMATE(int);
                                break;
                        case TYPE_lng:
-                               estimate = (BUN) (*(lng *) th - *(lng *) tl);
+                               CALC_ESTIMATE(lng);
                                break;
 #ifdef HAVE_HGE
                        case TYPE_hge:
-                               if (*(hge *) th - *(hge *) tl < (hge) BUN_MAX)
-                                       estimate = (BUN) (*(hge *) th - *(hge 
*) tl);
+                               CALC_ESTIMATE(hge);
                                break;
 #endif
                        }
-                       if (estimate != BUN_NONE)
+                       if (estimate == BUN_NONE)
                                estimate += li + hi - 1;
                }
        }
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -230,51 +230,36 @@ gdk_export void MT_thread_set_qry_ctx(Qr
                TRC_DEBUG(TEM, "Locking %s complete\n", (l)->name);     \
        } while (0)
 
-#define _DBG_LOCK_INIT(l)                                              \
-       do {                                                            \
-               (l)->count = 0;                                         \
-               ATOMIC_INIT(&(l)->contention, 0);                       \
-               ATOMIC_INIT(&(l)->sleep, 0);                            \
-               (l)->locker = NULL;                                     \
-               (l)->thread = NULL;                                     \
-               /* if name starts with "sa_" don't link in GDKlocklist */ \
-               /* since the lock is in memory that is governed by the */ \
-               /* SQL storage allocator, and hence we have no control */ \
-               /* over when the lock is destroyed and the memory freed */ \
-               if (strncmp((l)->name, "sa_", 3) != 0) {                \
-                       while (ATOMIC_TAS(&GDKlocklistlock) != 0)       \
-                               ;                                       \
-                       if (GDKlocklist)                                \
-                               GDKlocklist->prev = (l);                \
-                       (l)->next = GDKlocklist;                        \
-                       (l)->prev = NULL;                               \
-                       GDKlocklist = (l);                              \
-                       ATOMIC_CLEAR(&GDKlocklistlock);                 \
-               } else {                                                \
-                       (l)->next = NULL;                               \
-                       (l)->prev = NULL;                               \
-               }                                                       \
+#define _DBG_LOCK_INIT(l)                                      \
+       do {                                                    \
+               (l)->count = 0;                                 \
+               ATOMIC_INIT(&(l)->contention, 0);               \
+               ATOMIC_INIT(&(l)->sleep, 0);                    \
+               (l)->locker = NULL;                             \
+               (l)->thread = NULL;                             \
+               while (ATOMIC_TAS(&GDKlocklistlock) != 0)       \
+                       ;                                       \
+               if (GDKlocklist)                                \
+                       GDKlocklist->prev = (l);                \
+               (l)->next = GDKlocklist;                        \
+               (l)->prev = NULL;                               \
+               GDKlocklist = (l);                              \
+               ATOMIC_CLEAR(&GDKlocklistlock);                 \
        } while (0)
 
-#define _DBG_LOCK_DESTROY(l)                                           \
-       do {                                                            \
-               /* if name starts with "sa_" don't link in GDKlocklist */ \
-               /* since the lock is in memory that is governed by the */ \
-               /* SQL storage allocator, and hence we have no control */ \
-               /* over when the lock is destroyed and the memory freed */ \
-               if (strncmp((l)->name, "sa_", 3) != 0) {                \
-                       while (ATOMIC_TAS(&GDKlocklistlock) != 0)       \
-                               ;                                       \
-                       if ((l)->next)                                  \
-                               (l)->next->prev = (l)->prev;            \
-                       if ((l)->prev)                                  \
-                               (l)->prev->next = (l)->next;            \
-                       else if (GDKlocklist == (l))                    \
-                               GDKlocklist = (l)->next;                \
-                       ATOMIC_CLEAR(&GDKlocklistlock);                 \
-                       ATOMIC_DESTROY(&(l)->contention);               \
-                       ATOMIC_DESTROY(&(l)->sleep);                    \
-               }                                                       \
+#define _DBG_LOCK_DESTROY(l)                                   \
+       do {                                                    \
+               while (ATOMIC_TAS(&GDKlocklistlock) != 0)       \
+                       ;                                       \
+               if ((l)->next)                                  \
+                       (l)->next->prev = (l)->prev;            \
+               if ((l)->prev)                                  \
+                       (l)->prev->next = (l)->next;            \
+               else if (GDKlocklist == (l))                    \
+                       GDKlocklist = (l)->next;                \
+               ATOMIC_CLEAR(&GDKlocklistlock);                 \
+               ATOMIC_DESTROY(&(l)->contention);               \
+               ATOMIC_DESTROY(&(l)->sleep);                    \
        } while (0)
 
 #else
diff --git a/geom/sql/conformance/Tests/All b/geom/sql/conformance/Tests/All
--- a/geom/sql/conformance/Tests/All
+++ b/geom/sql/conformance/Tests/All
@@ -46,8 +46,8 @@ HAVE_GEOM?T44
 HAVE_GEOM?T45
 HAVE_GEOM?T46
 HAVE_GEOM?T47
-HAVE_GEOM?T48
-#HAVE_GEOM?T49 # disabled because depends on geos library version
+HAVE_GEOM&GEOS_VERSION>=3.9?T48
+HAVE_GEOM&GEOS_VERSION>=3.9?T49
 HAVE_GEOM?T50
 HAVE_GEOM?T51
 HAVE_GEOM?T52
diff --git a/geom/sql/conformance/Tests/T49.test 
b/geom/sql/conformance/Tests/T49.test
--- a/geom/sql/conformance/Tests/T49.test
+++ b/geom/sql/conformance/Tests/T49.test
@@ -1,5 +1,5 @@
 query T rowsort
 SELECT ST_AsText(ST_Union(shore, boundary)) FROM lakes, named_places WHERE 
lakes.name = 'Blue Lake' AND named_places.name = 'Goose Island'
 ----
-POLYGON ((52 18, 66 23, 73 9, 48 6, 52 18))
+POLYGON ((66 23, 73 9, 48 6, 52 18, 66 23))
 
diff --git a/geom/sql/functions/Tests/All b/geom/sql/functions/Tests/All
--- a/geom/sql/functions/Tests/All
+++ b/geom/sql/functions/Tests/All
@@ -20,7 +20,7 @@ HAVE_GEOM?ST_AsText
 
 HAVE_GEOM?ST_IsClosed
 HAVE_GEOM?ST_IsEmpty
-HAVE_GEOM?ST_IsSimple
+HAVE_GEOM&GEOS_VERSION>=3.8?ST_IsSimple
 HAVE_GEOM?ST_IsValid
 HAVE_GEOM?ST_IsRing
 
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
@@ -1265,10 +1265,10 @@ addArgument(MalBlkPtr mb, InstrPtr p, in
        if (p->argc == p->maxarg) {
                pn = extendInstruction(mb, p);
 #ifndef NDEBUG
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to