MonetDB: default - Possible fix for tests failing on Windows and...

2020-05-21 Thread Pedro Ferreira
Changeset: c8e3cbf52ccf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8e3cbf52ccf
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

Possible fix for tests failing on Windows and MacOS, The possible right side of 
e_cmp at rel_in_exp, may contain a list of expressions or a single one


diffs (93 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1598,6 +1598,21 @@ push_select_exp(mvc *sql, sql_rel *rel, 
 }
 
 static sql_rel *
+push_join_exp(mvc *sql, sql_rel *rel, sql_exp *e, sql_exp *L, sql_exp *R, 
sql_exp *R2, int f)
+{
+   sql_rel *r;
+   if (/*is_semi(rel->op) ||*/ (is_outerjoin(rel->op) && 
!is_processed((rel {
+   rel_join_add_exp(sql->sa, rel, e);
+   return rel;
+   }
+   /* push join into the given relation */
+   if ((r = rel_push_join(sql, rel, L, R, R2, e, f)) != NULL)
+   return r;
+   rel_join_add_exp(sql->sa, rel, e);
+   return rel;
+}
+
+static sql_rel *
 rel_filter(mvc *sql, sql_rel *rel, list *l, list *r, char *sname, char 
*filter_op, int anti, int ff)
 {
node *n;
@@ -1678,17 +1693,9 @@ rel_filter(mvc *sql, sql_rel *rel, list 
 
return push_select_exp(sql, rel, e, l->h->data, L, ff);
} else { /* join */
-   sql_rel *r;
-   if (/*is_semi(rel->op) ||*/ (is_outerjoin(rel->op) && 
!is_processed((rel {
-   rel_join_add_exp(sql->sa, rel, e);
-   return rel;
-   }
-   /* push join into the given relation */
-   if ((r = rel_push_join(sql, rel, L, R, NULL, e, ff)) != NULL)
-   return r;
-   rel_join_add_exp(sql->sa, rel, e);
-   return rel;
-   }
+   return push_join_exp(sql, rel, e, L, R, NULL, ff);
+   }
+   return rel;
 }
 
 static sql_rel *
@@ -1714,17 +1721,9 @@ rel_select_push_exp_down(mvc *sql, sql_r
 
return push_select_exp(sql, rel, e, ls, L, f);
} else { /* join */
-   sql_rel *r;
-   if (/*is_semi(rel->op) ||*/ (is_outerjoin(rel->op) && 
!is_processed((rel {
-   rel_join_add_exp(sql->sa, rel, e);
-   return rel;
-   }
-   /* push join into the given relation */
-   if ((r = rel_push_join(sql, rel, L, R, rs2, e, f)) != NULL)
-   return r;
-   rel_join_add_exp(sql->sa, rel, e);
-   return rel;
-   }
+   return push_join_exp(sql, rel, e, L, R, rs2, f);
+   }
+   return rel;
 }
 
 static sql_rel *
@@ -2169,8 +2168,23 @@ rel_in_exp(sql_query *query, sql_rel *re
if (!e || !rel)
return NULL;
 
-   if (e->type == e_cmp) /* it's a exp_in or cmp_equal of simple 
expressions, push down early on if possible */
-   return rel_select_push_exp_down(sql, rel, e, e->l, e->l, e->r, 
e->r, NULL, f);
+   if (e->type == e_cmp) { /* it's a exp_in or cmp_equal of simple 
expressions, push down early on if possible */
+   sql_exp *ls = e->l;
+   bool rlist = (e->flag == cmp_in || e->flag == cmp_notin);
+   unsigned int rcard = rlist ? exps_card(e->r) : exp_card(e->r);
+   int r_is_atoms = rlist ? exps_are_atoms(e->r) : 
exp_is_atom(e->r);
+   int r_has_freevar = rlist ? exps_have_freevar(sql, e->r) : 
exp_has_freevar(sql, e->r);
+
+   if (rcard <= CARD_ATOM && (r_is_atoms || r_has_freevar || 
exp_has_freevar(sql, ls))) {
+   if ((exp_card(ls) == rcard) || rel->processed) /* bin 
compare op */
+   return rel_select(sql->sa, rel, e);
+
+   return push_select_exp(sql, rel, e, ls, ls, f);
+   } else { /* join */
+   sql_exp *rs = rlist ? ((list*)e->r)->h->data : e->r;
+   return push_join_exp(sql, rel, e, ls, rs, NULL, f);
+   }
+   }
return rel_select_add_exp(sql->sa, rel, e);
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mbedded - we need to escape windows path's

2020-05-21 Thread Niels Nes
Changeset: e8fc77a0c1cc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e8fc77a0c1cc
Modified Files:
testing/CMakeLists.txt
Branch: mbedded
Log Message:

we need to escape windows path's


diffs (16 lines):

diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -26,7 +26,11 @@ endif()
 set(QXmandir "${CMAKE_INSTALL_MANDIR}")
 set(QXprefix "${CMAKE_INSTALL_PREFIX}")
 set(QXPYTHON "${Python3_EXECUTABLE}")
-set(QXPYTHON_LIBDIR "${PYTHON3_LIBDIR}")
+if (WIN32)
+   string(REPLACE "/" "" QXPYTHON_LIBDIR "${PYTHON3_LIBDIR}")
+else()
+  set(QXPYTHON_LIBDIR "${PYTHON3_LIBDIR}")
+endif()
 set(QXSOURCE "${CMAKE_SOURCE_DIR}")
 set(QXsysconfdir "${CMAKE_INSTALL_SYSCONFDIR}")
 set(SOURCE "${CMAKE_SOURCE_DIR}")
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mbedded - find the libdir (without the prefix), then wh...

2020-05-21 Thread Niels Nes
Changeset: 6f69dff54d4e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6f69dff54d4e
Modified Files:
CMakeLists.txt
testing/CMakeLists.txt
testing/monetdb_mtest.bat.in
testing/monetdb_mtest.sh.in
Branch: mbedded
Log Message:

find the libdir (without the prefix), then when installing the MonetDBTesting 
python tools
use ${CMAKE_INSTALL_PREFIX}/${PYTHON3_LIBDIR}
within Mtest we need the PYTHON3_LIBDIR without prefix.


diffs (46 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,8 +107,8 @@ monetdb_macro_variables()
 # Some custom target will need these setting.
 include(monetdb-custom-targets)
 
-# Used for installing testing python module
-execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import 
distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(0,0,'${MONETDB_PREFIX}'))"
+# Used for installing testing python module (don't pass a location, else we 
need to strip this again)
+execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import 
distutils.sysconfig; print(distutils.sysconfig.get_python_lib(0,0,''))"
RESULT_VARIABLE PY3_LIBDIR_CODE 
OUTPUT_VARIABLE PYTHON3_SITEDIR 
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -124,7 +124,7 @@ if(PYTHON3_LIBDIR)
 exportutils.py
 malcheck.py
 sqllogictest.py
-DESTINATION ${PYTHON3_LIBDIR}/MonetDBtesting
+   DESTINATION 
${CMAKE_INSTALL_PREFIX}/${PYTHON3_LIBDIR}/MonetDBtesting
 COMPONENT pytesting)
 endif()
 
diff --git a/testing/monetdb_mtest.bat.in b/testing/monetdb_mtest.bat.in
--- a/testing/monetdb_mtest.bat.in
+++ b/testing/monetdb_mtest.bat.in
@@ -7,5 +7,4 @@
 @echo off
 
 set PATH=@CMAKE_INSTALL_FULL_BINDIR@;%PATH%
-set PYTHONPATH=@QXPYTHON3_LIBDIR@;%PYTHONPATH%
 @CMAKE_INSTALL_FULL_BINDIR@/Mtest.py
diff --git a/testing/monetdb_mtest.sh.in b/testing/monetdb_mtest.sh.in
--- a/testing/monetdb_mtest.sh.in
+++ b/testing/monetdb_mtest.sh.in
@@ -5,6 +5,6 @@
 #
 # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
 
-PATH=@CMAKE_INSTALL_FULL_BINDIR@:$PATH 
PYTHONPATH=@QXPYTHON3_LIBDIR@:$PYTHONPATH @CMAKE_INSTALL_FULL_BINDIR@/Mtest.py
+PATH=@CMAKE_INSTALL_FULL_BINDIR@:$PATH @CMAKE_INSTALL_FULL_BINDIR@/Mtest.py
 
 exit 0
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mbedded - merged with default

2020-05-21 Thread Niels Nes
Changeset: 2a0fd391 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2a0fd391
Added Files:
sql/test/BugTracker-2020/Tests/ilike-matches.Bug-6864.sql
sql/test/BugTracker-2020/Tests/ilike-matches.Bug-6864.stable.err
sql/test/BugTracker-2020/Tests/ilike-matches.Bug-6864.stable.out
Modified Files:
buildtools/conf/Maddlog
gdk/gdk_batop.c
monetdb5/modules/mal/pcre.c
sql/server/rel_optimizer.c
sql/server/rel_unnest.c

sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
sql/test/BugTracker-2020/Tests/All
Branch: mbedded
Log Message:

merged with default


diffs (truncated from 482 to 300 lines):

diff --git a/buildtools/conf/Maddlog b/buildtools/conf/Maddlog
--- a/buildtools/conf/Maddlog
+++ b/buildtools/conf/Maddlog
@@ -123,7 +123,7 @@ fi
 case "$CL" in
 '')
 d=.
-while [ ! -f $d/vertoo.data -a ! -f $d/ChangeLog -a ! -f $d/ChangeLog.$tag 
]; do
+while [ ! -f $d/.bumpversion.cfg -a ! -f $d/ChangeLog -a ! -f 
$d/ChangeLog.$tag ]; do
if [ $d -ef / ]; then
echo "$0: cannot find top directory of package" >&2
exit 1
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -865,6 +865,15 @@ BATreplace(BAT *b, BAT *p, BAT *n, bool 
return GDK_FAIL;
}
 
+   BATiter bi = bat_iterator(b);
+   BATiter ni = bat_iterator(n);
+   if (BATcount(b) == 0 ||
+   (b->tsorted && b->trevsorted &&
+n->tsorted && n->trevsorted &&
+ATOMcmp(b->ttype, BUNtail(bi, 0), BUNtail(ni, 0)) == 0)) {
+   return GDK_SUCCEED;
+   }
+
HASHdestroy(b);
OIDXdestroy(b);
IMPSdestroy(b);
@@ -881,8 +890,6 @@ BATreplace(BAT *b, BAT *p, BAT *n, bool 
int (*atomcmp)(const void *, const void *) = ATOMcompare(b->ttype);
const void *nil = ATOMnilptr(b->ttype);
oid hseqend = b->hseqbase + BATcount(b);
-   BATiter bi = bat_iterator(b);
-   BATiter ni = bat_iterator(n);
bool anynil = false;
 
b->theap.dirty = true;
@@ -2127,8 +2134,29 @@ BATconstant(oid hseq, int tailtype, cons
((hge *) p)[i] = *(hge *) v;
break;
 #endif
+   case TYPE_str:
+   /* insert the first value, then just copy the
+* offset lots of times */
+   if (tfastins_nocheck(bn, 0, v, Tsize(bn)) != 
GDK_SUCCEED) {
+   BBPreclaim(bn);
+   return NULL;
+   }
+   char val[sizeof(var_t)];
+   memcpy(val, bn->theap.base, bn->twidth);
+   if (bn->twidth == 1 && n > 1) {
+   /* single byte value: we have a
+* function for that */
+   memset(bn->theap.base + 1, val[0], n - 1);
+   } else {
+   char *p = bn->theap.base;
+   for (i = 1; i < n; i++) {
+   p += bn->twidth;
+   memcpy(p, val, bn->twidth);
+   }
+   }
+   break;
default:
-   for (i = 0, n += i; i < n; i++)
+   for (i = 0; i < n; i++)
if (tfastins_nocheck(bn, i, v, Tsize(bn)) != 
GDK_SUCCEED) {
BBPreclaim(bn);
return NULL;
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -479,7 +479,7 @@ re_create(const char *pat, bool caseigno
} else if (*wp == esc) {
escaped = true;
} else if (*wp == '%') {
-   n->len = (size_t) (wq - r->w);
+   n->len = (size_t) (wq - n->w);
while (wp[1] == '%')
wp++;
if (wp[1]) {
@@ -509,7 +509,7 @@ re_create(const char *pat, bool caseigno
} else if ((unsigned char) *p == esc) {
escaped = true;
} else if (*p == '%') {
-   n->len = (size_t) (q - r->k);
+   n->len = (size_t) (q - n->k);
while (p[1] == '%')
p++;
if (p[1]) {
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -1265,10 +