MonetDB: mbedded - merged with default

2020-05-15 Thread Niels Nes
Changeset: 6c838c073f6e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6c838c073f6e
Added Files:
buildtools/selinux/ChangeLog.Jun2020
clients/odbc/ChangeLog-Archive
debian/libmonetdb20.install
documentation/source/manual_pages/README
sql/server/cmp_exp_eval.h
sql/server/rel_out2inner_join.txt
sql/server/rel_outer_join_optimizer.h
sql/test/Triggers/Tests/trigger_projection.sql.src
sql/test/Triggers/Tests/trigger_projection.stable.err
sql/test/Triggers/Tests/trigger_projection.stable.out
sql/test/Triggers/trigger_projection.sql
sql/test/Users/Tests/createUserRollback.SQL.py
sql/test/Users/Tests/createUserRollback.stable.err
sql/test/Users/Tests/createUserRollback.stable.out
Removed Files:
ChangeLog.Nov2019
buildtools/ChangeLog.Nov2019
clients/ChangeLog.Nov2019
clients/mapilib/ChangeLog.Nov2019
common/stream/ChangeLog.Nov2019
debian/libmonetdb19.install
gdk/ChangeLog.Nov2019
geom/ChangeLog.Nov2019
monetdb5/ChangeLog.Nov2019
sql/ChangeLog.Nov2019
sql/test/miscellaneous/Tests/trigger_projection.sql
sql/test/miscellaneous/Tests/trigger_projection.stable.err
sql/test/miscellaneous/Tests/trigger_projection.stable.out
testing/ChangeLog.Nov2019
tools/merovingian/ChangeLog.Nov2019
Modified Files:
.hgtags
ChangeLog-Archive
ChangeLog.Jun2020
MonetDB.spec
NT/monetdb_config.h.in
NT/rules.msc
buildtools/selinux/ChangeLog-Archive
clients/ChangeLog-Archive
clients/ChangeLog.Jun2020
clients/Tests/exports.stable.out
clients/mapiclient/mclient.1
clients/mapiclient/msqldump.1
clients/mapilib/mapi.rc
clients/odbc/ChangeLog.Jun2020
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
debian/changelog
debian/control
documentation/source/manual_pages/mclient.rst
documentation/source/manual_pages/monetdb.rst
documentation/source/manual_pages/monetdbd.rst.in
documentation/source/manual_pages/mserver5.rst.in
documentation/source/manual_pages/msqldump.rst
gdk/ChangeLog-Archive
gdk/ChangeLog.Jun2020
gdk/gdk.h
gdk/gdk_atoms.h
gdk/gdk_batop.c
gdk/gdk_hash.c
gdk/gdk_join.c
gdk/gdk_storage.c
gdk/gdk_system.h
gdk/gdk_utils.h
gdk/libbat.rc
geom/lib/libgeom.h
geom/monetdb5/geom.c
monetdb5/ChangeLog-Archive
monetdb5/ChangeLog.Jun2020
monetdb5/extras/rapi/rapi.c
monetdb5/mal/mal.h
monetdb5/mal/mal_client.c
monetdb5/mal/mal_runtime.c
monetdb5/modules/mal/mkey.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/tools/Tests/mserver5--help.stable.err
monetdb5/tools/Tests/mserver5--help.stable.err.Windows
monetdb5/tools/libmonetdb5.rc
sql/ChangeLog-Archive
sql/ChangeLog.Jun2020
sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out
sql/backends/monet5/UDF/pyapi3/pyheader.h
sql/backends/monet5/sql_rank.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/sql_user.c
sql/common/sql_types.c
sql/include/sql_catalog.h
sql/include/sql_relation.h
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
sql/server/sql_partition.c
sql/server/sql_query.c
sql/server/sql_semantic.c
sql/storage/bat/bat_logger.c
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c

sql/test/BugDay_2005-10-06_2.9.3/Tests/CrashMe_SQL_server_crash-2.SF-921673.stable.out

sql/test/BugTracker-2008/Tests/select_not_wrong_result.SF-2080151.stable.out
sql/test/BugTracker-2009/Tests/join_topn.SF-2654133.stable.out
sql/test/BugTracker-2012/Tests/currenttime.Bug-2781.SQL.py
sql/test/BugTracker-2012/Tests/currenttime.Bug-2781.stable.out

sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.single
sql/test/Triggers/Tests/All
sql/test/Triggers/run.all
sql/test/Users/Tests/All
sql/test/bugs/Tests/innerjoin_multiple-bug-sf-943661.stable.out
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128

sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out

MonetDB: Jun2020 - Optimize x in (constants) into cmp_in instead...

2020-05-15 Thread Pedro Ferreira
Changeset: 402f401ed9f8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=402f401ed9f8
Modified Files:
sql/server/rel_rel.c
sql/server/rel_select.c
sql/test/miscellaneous/Tests/simple_plans.stable.out
Branch: Jun2020
Log Message:

Optimize x in (constants) into cmp_in instead of a call to anyequal, which 
gives the possibility to an early pushdown. Also attempt to pushdown earlier 
comparisons on columns with constants


diffs (truncated from 326 to 300 lines):

diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -1296,7 +1296,6 @@ rel_push_select(mvc *sql, sql_rel *rel, 
return rel;
 }
 
-
 /* ls and rs are the left and right expression of the join, e is the
join expression.
  */
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
@@ -1699,6 +1699,46 @@ rel_filter_exp_(mvc *sql, sql_rel *rel, 
 }
 
 static sql_rel *
+rel_compare_push_exp(mvc *sql, sql_rel *rel, sql_exp *e, sql_exp *ls, sql_exp 
*L, sql_exp *rs, sql_exp *R, sql_exp *rs2)
+{
+   if (rs->card <= CARD_ATOM && (exp_is_atom(rs) || exp_has_freevar(sql, 
rs) || exp_has_freevar(sql, ls)) &&
+  (!rs2 || (rs2->card <= CARD_ATOM && (exp_is_atom(rs2) || 
exp_has_freevar(sql, rs2) {
+   if ((ls->card == rs->card && !rs2) || rel->processed)  /* bin 
compare op */
+   return rel_select(sql->sa, rel, e);
+
+   if (/*is_semi(rel->op) ||*/ is_outerjoin(rel->op)) {
+   if ((is_left(rel->op) || is_full(rel->op)) && 
rel_find_exp(rel->l, ls)) {
+   rel_join_add_exp(sql->sa, rel, e);
+   return rel;
+   } else if ((is_right(rel->op) || is_full(rel->op)) && 
rel_find_exp(rel->r, ls)) {
+   rel_join_add_exp(sql->sa, rel, e);
+   return rel;
+   }
+   if (is_left(rel->op) && rel_find_exp(rel->r, ls)) {
+   rel->r = rel_push_select(sql, rel->r, L, e);
+   return rel;
+   } else if (is_right(rel->op) && rel_find_exp(rel->l, 
ls)) {
+   rel->l = rel_push_select(sql, rel->l, L, e);
+   return rel;
+   }
+   }
+   /* push select into the given relation */
+   return rel_push_select(sql, rel, L, e);
+   } 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)) != NULL)
+   return r;
+   rel_join_add_exp(sql->sa, rel, e);
+   return rel;
+   }
+}
+
+static sql_rel *
 rel_compare_exp_(sql_query *query, sql_rel *rel, sql_exp *ls, sql_exp *rs, 
sql_exp *rs2, int type, int anti, int quantifier)
 {
mvc *sql = query->sql;
@@ -1759,45 +1799,7 @@ rel_compare_exp_(sql_query *query, sql_r
else
return sql_error(sql, ERR_GROUPBY, SQLSTATE(42000) 
"SELECT: cannot use non GROUP BY column in query results without an aggregate 
function");
}
-   if (rs->card <= CARD_ATOM && (exp_is_atom(rs) || exp_has_freevar(sql, 
rs) || exp_has_freevar(sql, ls)) &&
-  (!rs2 || (rs2->card <= CARD_ATOM && (exp_is_atom(rs2) || 
exp_has_freevar(sql, rs2) {
-   if ((ls->card == rs->card && !rs2) || rel->processed)  /* bin 
compare op */
-   return rel_select(sql->sa, rel, e);
-
-   if (/*is_semi(rel->op) ||*/ is_outerjoin(rel->op)) {
-   if ((is_left(rel->op) || is_full(rel->op)) && 
rel_find_exp(rel->l, ls)) {
-   rel_join_add_exp(sql->sa, rel, e);
-   return rel;
-   } else if ((is_right(rel->op) || is_full(rel->op)) && 
rel_find_exp(rel->r, ls)) {
-   rel_join_add_exp(sql->sa, rel, e);
-   return rel;
-   }
-   if (is_semi(rel->op)) {
-   rel_join_add_exp(sql->sa, rel, e);
-   return rel;
-   }
-   if (is_left(rel->op) && rel_find_exp(rel->r, ls)) {
-   rel->r = rel_push_select(sql, rel->r, L, e);
-   return rel;
-   } else if (is_right(rel->op) && rel_find_exp(rel->l, 
ls)) {
-   rel->l = rel_push_select(sql, rel->l, L, 

MonetDB: mbedded - merged

2020-05-15 Thread Niels Nes
Changeset: 54ca8c8fd7c0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54ca8c8fd7c0
Modified Files:
cmake/monetdb-defines.cmake
cmake/monetdb-findpackages.cmake
cmake/monetdb-functions.cmake
Branch: mbedded
Log Message:

merged


diffs (163 lines):

diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -7,7 +7,6 @@
 #]]
 
 function(monetdb_configure_defines)
-  check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H)
   find_path(HAVE_DISPATCH_DISPATCH_H "dispatch/dispatch.h")
   find_path(HAVE_DLFCN_H "dlfcn.h")
   find_path(HAVE_FCNTL_H "fcntl.h")
@@ -20,7 +19,6 @@ function(monetdb_configure_defines)
   find_path(HAVE_MACH_MACH_INIT_H "mach/mach_init.h")
   find_path(HAVE_MACH_TASK_H "mach/task.h")
   find_path(HAVE_MACH_O_DYLD_H "mach-o/dyld.h")
-  check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H)
   find_path(HAVE_NETINET_IN_H "netinet/in.h")
   find_path(HAVE_POLL_H "poll.h")
   find_path(HAVE_PROCFS_H "procfs.h")
@@ -33,8 +31,6 @@ function(monetdb_configure_defines)
   find_path(HAVE_SYS_MMAN_H "sys/mman.h")
   find_path(HAVE_SYS_PARAM_H "sys/param.h")
   find_path(HAVE_SYS_RESOURCE_H "sys/resource.h")
-  check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H)
-  check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H)
   find_path(HAVE_SYS_TIMES_H "sys/times.h")
   find_path(HAVE_SYS_UIO_H "sys/uio.h")
   find_path(HAVE_SYS_UN_H "sys/un.h")
@@ -44,16 +40,16 @@ function(monetdb_configure_defines)
   find_path(HAVE_UNISTD_H "unistd.h")
   find_path(HAVE_UUID_UUID_H "uuid/uuid.h")
   find_path(HAVE_WINSOCK_H "winsock2.h")
-
   find_path(HAVE_SYS_TYPES_H "sys/types.h")
   find_path(HAVE_SEMAPHORE_H "semaphore.h")
   find_path(HAVE_GETOPT_H "getopt.h")
-  if(HAVE_GETOPT_H)
-set(HAVE_GETOPT 1 PARENT_SCOPE)
-  endif()
 
   check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
 
+  check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H)
+  check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H)
+  check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H)
+  check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H)
   # Linux specific, in the future, it might be ported to other platforms
   check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H)
   check_symbol_exists("getaddrinfo" "netdb.h" UNIX_GETADDRINFO)
@@ -67,13 +63,16 @@ function(monetdb_configure_defines)
 
   #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H)
   check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC)
-
-  check_symbol_exists("accept4" "sys/types.h;sys/socket.h" HAVE_ACCEPT4) # 
Some libc versions on Linux distributions don't have it
+  # Some libc versions on Linux distributions don't have it
+  check_symbol_exists("accept4"
+"sys/types.h;sys/socket.h" HAVE_ACCEPT4)
   check_symbol_exists("asctime_r" "time.h" HAVE_ASCTIME_R)
   check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
   check_symbol_exists("ctime_r" "time.h" HAVE_CTIME_R)
-  check_symbol_exists("dispatch_semaphore_create" "dispatch/dispatch.h" 
HAVE_DISPATCH_SEMAPHORE_CREATE)
-  check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE) # Linux specific, 
in the future, it might be ported to other platforms
+  check_symbol_exists("dispatch_semaphore_create"
+"dispatch/dispatch.h" HAVE_DISPATCH_SEMAPHORE_CREATE)
+  # Linux specific, in the future, it might be ported to other platforms
+  check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE)
   check_function_exists("fcntl" HAVE_FCNTL)
   check_symbol_exists("fork" "unistd.h" HAVE_FORK)
   check_symbol_exists("fsync" "unistd.h" HAVE_FSYNC)
@@ -93,31 +92,36 @@ function(monetdb_configure_defines)
   check_function_exists("nanosleep" HAVE_NANOSLEEP)
   check_function_exists("nl_langinfo" HAVE_NL_LANGINFO)
   check_function_exists("_NSGetExecutablePath" HAVE__NSGETEXECUTABLEPATH)
-  check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2) # Some libc 
versions on Linux distributions don't have it
-  check_function_exists("poll" HAVE_POLL) 
+  # Some libc versions on Linux distributions don't have it
+  check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2)
+  check_function_exists("poll" HAVE_POLL)
   check_symbol_exists("popen" "stdio.h" HAVE_POPEN)
-  check_symbol_exists("posix_fadvise" "fcntl.h" HAVE_POSIX_FADVISE) 
-  check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE) # Some 
POSIX systems don't have it (e.g. Macos)
+  check_symbol_exists("posix_fadvise" "fcntl.h" HAVE_POSIX_FADVISE)
+  # Some POSIX systems don't have it (e.g. Macos)
+  check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE)
   check_symbol_exists("posix_madvise" "sys/mman.h" HAVE_POSIX_MADVISE)
-  check_function_exists("putenv" HAVE_PUTENV) 
-  check_function_exists("setsid" HAVE_SETSID) 
-  check_function_exists("shutdown" HAVE_SHUTDOWN) 
-  check_function_exists("sigaction" HAVE_SIGACTION) 
- 

MonetDB: mbedded - bring variables to the outer scope

2020-05-15 Thread Niels Nes
Changeset: 73d4d090226d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=73d4d090226d
Modified Files:
cmake/monetdb-defines.cmake
Branch: mbedded
Log Message:

bring variables to the outer scope
use a different value for check_symbol('bla')


diffs (29 lines):

diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -49,15 +49,22 @@ function(monetdb_configure_defines)
   find_path(HAVE_SEMAPHORE_H "semaphore.h")
   find_path(HAVE_GETOPT_H "getopt.h")
   if(HAVE_GETOPT_H)
-set(HAVE_GETOPT 1)
+set(HAVE_GETOPT 1 PARENT_SCOPE)
   endif()
 
   check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
 
   # Linux specific, in the future, it might be ported to other platforms
   check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H)
-  check_symbol_exists("getaddrinfo" "netdb.h" HAVE_GETADDRINFO)
-  check_symbol_exists("getaddrinfo" "ws2tcpip.h" HAVE_GETADDRINFO)
+  check_symbol_exists("getaddrinfo" "netdb.h" UNIX_GETADDRINFO)
+  check_symbol_exists("getaddrinfo" "ws2tcpip.h" WIN_GETADDRINFO)
+  if(UNIX_GETADDRINF)
+ set(HAVE_GETADDRINFO 1 PARENT_SCOPE)
+  endif()
+  if(WIN_GETADDRINF)
+ set(HAVE_GETADDRINFO 1 PARENT_SCOPE)
+  endif()
+
   #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H)
   check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC)
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mbedded - needed before the check for symbols

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

needed before the check for symbols


diffs (23 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,9 @@ include(CheckTypeSize REQUIRED)
 include(TestBigEndian REQUIRED)
 
 # Include MonetDB specific functions
+if(WIN32)
+  set(CMAKE_REQUIRED_LIBRARIES  ws2_32.lib shell32.lib advapi32.lib)
+endif()
 include(monetdb-functions)
 include(monetdb-findpackages)
 include(monetdb-defines)
@@ -64,9 +67,6 @@ endif()
 if(HAVE_WINSOCK_H)
   set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h")
 endif()
-if(WIN32)
-  set(CMAKE_REQUIRED_LIBRARIES  ws2_32.lib shell32.lib advapi32.lib)
-endif()
 check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C)
 
 set(CMAKE_REQUIRED_INCLUDES "/usr/include")
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mbedded - add required libraries for windows

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

add required libraries for windows


diffs (13 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,9 @@ endif()
 if(HAVE_WINSOCK_H)
   set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h")
 endif()
+if(WIN32)
+  set(CMAKE_REQUIRED_LIBRARIES  ws2_32.lib shell32.lib advapi32.lib)
+endif()
 check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C)
 
 set(CMAKE_REQUIRED_INCLUDES "/usr/include")
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mbedded - small changes to cleanup code a little bit

2020-05-15 Thread Arjen de Rijke
Changeset: 233b4e5c3b0b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=233b4e5c3b0b
Modified Files:
cmake/monetdb-defines.cmake
cmake/monetdb-findpackages.cmake
cmake/monetdb-functions.cmake
Branch: mbedded
Log Message:

small changes to cleanup code a little bit


diffs (162 lines):

diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -7,7 +7,6 @@
 #]]
 
 function(monetdb_configure_defines)
-  check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H)
   find_path(HAVE_DISPATCH_DISPATCH_H "dispatch/dispatch.h")
   find_path(HAVE_DLFCN_H "dlfcn.h")
   find_path(HAVE_FCNTL_H "fcntl.h")
@@ -20,7 +19,6 @@ function(monetdb_configure_defines)
   find_path(HAVE_MACH_MACH_INIT_H "mach/mach_init.h")
   find_path(HAVE_MACH_TASK_H "mach/task.h")
   find_path(HAVE_MACH_O_DYLD_H "mach-o/dyld.h")
-  check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H)
   find_path(HAVE_NETINET_IN_H "netinet/in.h")
   find_path(HAVE_POLL_H "poll.h")
   find_path(HAVE_PROCFS_H "procfs.h")
@@ -33,8 +31,6 @@ function(monetdb_configure_defines)
   find_path(HAVE_SYS_MMAN_H "sys/mman.h")
   find_path(HAVE_SYS_PARAM_H "sys/param.h")
   find_path(HAVE_SYS_RESOURCE_H "sys/resource.h")
-  check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H)
-  check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H)
   find_path(HAVE_SYS_TIMES_H "sys/times.h")
   find_path(HAVE_SYS_UIO_H "sys/uio.h")
   find_path(HAVE_SYS_UN_H "sys/un.h")
@@ -44,29 +40,32 @@ function(monetdb_configure_defines)
   find_path(HAVE_UNISTD_H "unistd.h")
   find_path(HAVE_UUID_UUID_H "uuid/uuid.h")
   find_path(HAVE_WINSOCK_H "winsock2.h")
-
   find_path(HAVE_SYS_TYPES_H "sys/types.h")
   find_path(HAVE_SEMAPHORE_H "semaphore.h")
   find_path(HAVE_GETOPT_H "getopt.h")
-  if(HAVE_GETOPT_H)
-set(HAVE_GETOPT 1)
-  endif()
 
   check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
 
+  check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H)
+  check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H)
+  check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H)
+  check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H)
   # Linux specific, in the future, it might be ported to other platforms
   check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H)
   check_symbol_exists("getaddrinfo" "netdb.h" HAVE_GETADDRINFO)
   check_symbol_exists("getaddrinfo" "ws2tcpip.h" HAVE_GETADDRINFO)
   #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H)
   check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC)
-
-  check_symbol_exists("accept4" "sys/types.h;sys/socket.h" HAVE_ACCEPT4) # 
Some libc versions on Linux distributions don't have it
+  # Some libc versions on Linux distributions don't have it
+  check_symbol_exists("accept4"
+"sys/types.h;sys/socket.h" HAVE_ACCEPT4)
   check_symbol_exists("asctime_r" "time.h" HAVE_ASCTIME_R)
   check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
   check_symbol_exists("ctime_r" "time.h" HAVE_CTIME_R)
-  check_symbol_exists("dispatch_semaphore_create" "dispatch/dispatch.h" 
HAVE_DISPATCH_SEMAPHORE_CREATE)
-  check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE) # Linux specific, 
in the future, it might be ported to other platforms
+  check_symbol_exists("dispatch_semaphore_create"
+"dispatch/dispatch.h" HAVE_DISPATCH_SEMAPHORE_CREATE)
+  # Linux specific, in the future, it might be ported to other platforms
+  check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE)
   check_function_exists("fcntl" HAVE_FCNTL)
   check_symbol_exists("fork" "unistd.h" HAVE_FORK)
   check_symbol_exists("fsync" "unistd.h" HAVE_FSYNC)
@@ -86,31 +85,36 @@ function(monetdb_configure_defines)
   check_function_exists("nanosleep" HAVE_NANOSLEEP)
   check_function_exists("nl_langinfo" HAVE_NL_LANGINFO)
   check_function_exists("_NSGetExecutablePath" HAVE__NSGETEXECUTABLEPATH)
-  check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2) # Some libc 
versions on Linux distributions don't have it
-  check_function_exists("poll" HAVE_POLL) 
+  # Some libc versions on Linux distributions don't have it
+  check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2)
+  check_function_exists("poll" HAVE_POLL)
   check_symbol_exists("popen" "stdio.h" HAVE_POPEN)
-  check_symbol_exists("posix_fadvise" "fcntl.h" HAVE_POSIX_FADVISE) 
-  check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE) # Some 
POSIX systems don't have it (e.g. Macos)
+  check_symbol_exists("posix_fadvise" "fcntl.h" HAVE_POSIX_FADVISE)
+  # Some POSIX systems don't have it (e.g. Macos)
+  check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE)
   check_symbol_exists("posix_madvise" "sys/mman.h" HAVE_POSIX_MADVISE)
-  check_function_exists("putenv" HAVE_PUTENV) 
-  check_function_exists("setsid" HAVE_SETSID) 
-  check_function_exists("shutdown" HAVE_SHUTDOWN) 
-  

MonetDB: mbedded - added check for getaddrinfo for windows

2020-05-15 Thread Niels Nes
Changeset: 158661a9cc02 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=158661a9cc02
Modified Files:
cmake/monetdb-defines.cmake
Branch: mbedded
Log Message:

added check for getaddrinfo for windows


diffs (11 lines):

diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -57,6 +57,7 @@ function(monetdb_configure_defines)
   # Linux specific, in the future, it might be ported to other platforms
   check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H)
   check_symbol_exists("getaddrinfo" "netdb.h" HAVE_GETADDRINFO)
+  check_symbol_exists("getaddrinfo" "ws2tcpip.h" HAVE_GETADDRINFO)
   #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H)
   check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC)
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - If the ouput type a function doesn't have a s...

2020-05-15 Thread Pedro Ferreira
Changeset: 3d806dfcd6ee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3d806dfcd6ee
Modified Files:
sql/common/sql_types.c
Branch: Jun2020
Log Message:

If the ouput type a function doesn't have a scale, don't set one

This fixes some superfluous casts at TPC-DS Q80


diffs (14 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -574,8 +574,8 @@ sql_dup_subfunc(sql_allocator *sa, sql_f
sql_arg *rarg = tn->data;
sql_subtype *res, *r = >type;

-   /* same scale as the input */
-   if (member && member->scale > scale)
+   /* same scale as the input if result has a 
scale */
+   if (member && (r->type->eclass == EC_ANY || 
r->type->scale != SCALE_NONE) && member->scale > scale)
scale = member->scale;
digits = r->digits;
if (!member) {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mbedded - let cmake/windows define their own SOCKET and...

2020-05-15 Thread Niels Nes
Changeset: d9463a3ac433 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d9463a3ac433
Modified Files:
monetdb_config_win32.h.in
Branch: mbedded
Log Message:

let cmake/windows define their own SOCKET and socketclose implementations


diffs (16 lines):

diff --git a/monetdb_config_win32.h.in b/monetdb_config_win32.h.in
--- a/monetdb_config_win32.h.in
+++ b/monetdb_config_win32.h.in
@@ -316,12 +316,6 @@ typedef __uint128_t uhge;
 #define static_assert(expr, mesg)  ((void) 0)
 #endif
 
-#ifndef SOCKET
-#define SOCKET int32_t
-#endif
-#ifndef closesocket
-#define closesocket close
-#endif
 #ifndef _In_z_
 #define _In_z_
 #endif
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge with Jun2020 branch.

2020-05-15 Thread Sjoerd Mullender
Changeset: 4d9f8b244437 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4d9f8b244437
Modified Files:
gdk/gdk_join.c
geom/monetdb5/geom.c
monetdb5/mal/mal_client.c
sql/backends/monet5/UDF/pyapi3/pyheader.h
sql/server/rel_select.c
sql/server/sql_partition.c
sql/server/sql_semantic.c
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c

sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.single
sql/test/wlcr/Tests/wlr110.py
sql/test/wlcr/Tests/wlr35.py
testing/Mtest.py.in
Branch: default
Log Message:

Merge with Jun2020 branch.


diffs (113 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3162,7 +3162,13 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   rcost = (double) rci.ncand * 2 + lci.ncand * 1.1;
+   rcost = lci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash for
+* non-persistent bats */
+   if (rci.ncand != BATcount(r) || !(BBP_status(r->batCacheid) & 
BBPEXISTING) || r->theap.dirty || GDKinmemory())
+#endif
+   rcost += rci.ncand * 2.0;
} else {
if (rci.noids > 0) {
/* if we need to do binary search on candidate
@@ -3205,7 +3211,13 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   lcost = (double) lci.ncand * 2 + rci.ncand * 1.1;
+   lcost = rci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash
+* for non-persistent bats */
+   if (lci.ncand != BATcount(l) || 
!(BBP_status(l->batCacheid) & BBPEXISTING) || l->theap.dirty || GDKinmemory())
+#endif
+   lcost += lci.ncand * 2.0;
} else {
if (lci.noids > 0) {
/* if we need to do binary search on candidate
@@ -3501,9 +3513,13 @@ BATjoin(BAT **r1p, BAT **r2p, BAT *l, BA
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   lcost = (double) lci.ncand * 2 + rci.ncand * 1.1;
-   if (lci.ncand == BATcount(l) && !l->batTransient)
-   lcost *= 0.8;
+   lcost = rci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash for
+* non-persistent bats */
+   if (lci.ncand != BATcount(l) || !(BBP_status(l->batCacheid) & 
BBPEXISTING) || l->theap.dirty || GDKinmemory())
+#endif
+   lcost += lci.ncand * 2.0;
} else {
if (lci.noids > 0) {
/* if we need to do binary search on candidate
@@ -3542,9 +3558,13 @@ BATjoin(BAT **r1p, BAT **r2p, BAT *l, BA
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   rcost = (double) rci.ncand * 2 + lci.ncand * 1.1;
-   if (rci.ncand == BATcount(r) && !r->batTransient)
-   rcost *= 0.8;
+   rcost = lci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash for
+* non-persistent bats */
+   if (rci.ncand != BATcount(r) || !(BBP_status(r->batCacheid) & 
BBPEXISTING) || r->theap.dirty || GDKinmemory())
+#endif
+   rcost += rci.ncand * 2.0;
} else {
if (rci.noids > 0) {
/* if we need to do binary search on candidate
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -133,14 +133,13 @@ static Client
 MCnewClient(void)
 {
Client c;
-   MT_lock_set(_contextLock);
+
for (c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
if (c->mode == FREECLIENT) {
c->mode = RUNCLIENT;
break;
}
}
-   MT_lock_unset(_contextLock);
 
if (c == mal_clients + MAL_MAXCLIENTS)
return NULL;
@@ -206,6 +205,7 @@ 

MonetDB: Jun2020 - Merge with linear-hashing branch.

2020-05-15 Thread Sjoerd Mullender
Changeset: 6f4adbfbee9f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6f4adbfbee9f
Modified Files:
geom/monetdb5/geom.c
monetdb5/mal/mal_client.c
sql/backends/monet5/UDF/pyapi3/pyheader.h
sql/server/rel_select.c
sql/server/sql_partition.c
sql/server/sql_semantic.c
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c

sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.single
sql/test/wlcr/Tests/wlr110.py
sql/test/wlcr/Tests/wlr35.py
testing/Mtest.py.in
Branch: Jun2020
Log Message:

Merge with linear-hashing branch.


diffs (46 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -133,14 +133,13 @@ static Client
 MCnewClient(void)
 {
Client c;
-   MT_lock_set(_contextLock);
+
for (c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
if (c->mode == FREECLIENT) {
c->mode = RUNCLIENT;
break;
}
}
-   MT_lock_unset(_contextLock);
 
if (c == mal_clients + MAL_MAXCLIENTS)
return NULL;
@@ -207,6 +206,7 @@ MCinitClientRecord(Client c, oid user, b
 {
const char *prompt;
 
+   /* mal_contextLock is held when this is called */
c->user = user;
c->username = 0;
c->scenario = NULL;
@@ -286,11 +286,15 @@ MCinitClient(oid user, bstream *fin, str
 {
Client c = NULL;
 
-   if ((c = MCnewClient()) == NULL)
-   return NULL;
-   return MCinitClientRecord(c, user, fin, fout);
+   MT_lock_set(_contextLock);
+   c = MCnewClient();
+   if (c)
+   c = MCinitClientRecord(c, user, fin, fout);
+   MT_lock_unset(_contextLock);
+   return c;
 }
 
+
 /*
  * The administrator should be initialized to enable interpretation of
  * the command line arguments, before it starts servicing statements
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: linear-hashing - Merge with Nov2019 branch.

2020-05-15 Thread Sjoerd Mullender
Changeset: 7c3e261a9f2e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7c3e261a9f2e
Modified Files:
geom/lib/libgeom.h
geom/monetdb5/geom.c
monetdb5/extras/rapi/rapi.c
sql/server/rel_select.c
sql/server/sql_partition.c
sql/server/sql_semantic.c
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c
testing/Mtest.py.in
Branch: linear-hashing
Log Message:

Merge with Nov2019 branch.


diffs (truncated from 461 to 300 lines):

diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -29,6 +29,7 @@
 #include 
 
 #ifdef HAVE_PROJ
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
 #include  //it is needed to transform from one srid to another
 #endif
 
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -45,7 +45,7 @@ wkbNULLcopy(void)
 #ifdef HAVE_PROJ
 
 /** convert degrees to radians */
-static void
+static inline void
 degrees2radians(double *x, double *y, double *z)
 {
*x *= M_PI / 180.0;
@@ -54,7 +54,7 @@ degrees2radians(double *x, double *y, do
 }
 
 /** convert radians to degrees */
-static void
+static inline void
 radians2degrees(double *x, double *y, double *z)
 {
*x *= 180.0 / M_PI;
diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c
--- a/monetdb5/extras/rapi/rapi.c
+++ b/monetdb5/extras/rapi/rapi.c
@@ -30,6 +30,7 @@
 
 #define USE_RINTERNALS 1
 
+#include 
 #include 
 #include 
 #include 
@@ -110,25 +111,34 @@ static char *RAPIinitialize(void) {
// set some command line arguments
{
structRstart rp;
-   Rstart Rp = 
-   char *rargv[] = { "R", "--slave", "--vanilla" };
+   char *rargv[] = { "R",
+#if R_VERSION >= R_Version(4,0,0)
+ "--no-echo",
+#else
+ "--slave",
+#endif
+ "--vanilla" };
int stat = 0;
 
-   R_DefParams(Rp);
-   Rp->R_Slave = (Rboolean) TRUE;
-   Rp->R_Quiet = (Rboolean) TRUE;
-   Rp->R_Interactive = (Rboolean) FALSE;
-   Rp->R_Verbose = (Rboolean) FALSE;
-   Rp->LoadSiteFile = (Rboolean) FALSE;
-   Rp->LoadInitFile = (Rboolean) FALSE;
-   Rp->RestoreAction = SA_NORESTORE;
-   Rp->SaveAction = SA_NOSAVE;
-   Rp->NoRenviron = TRUE;
+   R_DefParams();
+#if R_VERSION >= R_Version(4,0,0)
+   rp.R_NoEcho = (Rboolean) TRUE;
+#else
+   rp.R_Slave = (Rboolean) TRUE;
+#endif
+   rp.R_Quiet = (Rboolean) TRUE;
+   rp.R_Interactive = (Rboolean) FALSE;
+   rp.R_Verbose = (Rboolean) FALSE;
+   rp.LoadSiteFile = (Rboolean) FALSE;
+   rp.LoadInitFile = (Rboolean) FALSE;
+   rp.RestoreAction = SA_NORESTORE;
+   rp.SaveAction = SA_NOSAVE;
+   rp.NoRenviron = TRUE;
stat = Rf_initialize_R(2, rargv);
if (stat < 0) {
return "Rf_initialize failed";
}
-   R_SetParams(Rp);
+   R_SetParams();
}
 
/* disable stack checking, because threads will throw it off */
diff --git a/sql/server/sql_partition.c b/sql/server/sql_partition.c
--- a/sql/server/sql_partition.c
+++ b/sql/server/sql_partition.c
@@ -10,6 +10,7 @@
 
 #include "sql_partition.h"
 #include "rel_rel.h"
+#include "rel_exp.h"
 #include "sql_mvc.h"
 #include "sql_catalog.h"
 #include "sql_relation.h"
@@ -217,50 +218,8 @@ exp_find_table_columns(mvc *sql, sql_exp
}
 }
 
-static str
-find_expression_type(sql_exp *e, sql_subtype *tpe)
-{
-   switch (e->type) {
-   case e_convert: {
-   assert(list_length(e->r) == 2);
-   *tpe = *(sql_subtype *)list_fetch(e->r, 1);
-   } break;
-   case e_atom: {
-   if (e->l) {
-   atom *a = e->l;
-   *tpe = a->tpe;
-   } else if (e->r) {
-   *tpe = e->tpe;
-   } else if (e->f) {
-   throw(SQL,"sql.partition", SQLSTATE(42000) 
"List of values not allowed in expressions");
-   } else {
-   throw(SQL,"sql.partition", SQLSTATE(42000) 
"Variables/parameters are not allowed in expressions");
-   }
-   } break;
-   case e_func: {
-   sql_subfunc *f = e->f;
-   sql_func *func = f->func;
-   if (list_length(func->res) != 1)
-   throw(SQL,"sql.partition", 

MonetDB: Jun2020 - Ignore the cost of creating a hash when the b...

2020-05-15 Thread Sjoerd Mullender
Changeset: ce23fa286bb6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ce23fa286bb6
Modified Files:
gdk/gdk_join.c
Branch: Jun2020
Log Message:

Ignore the cost of creating a hash when the bat is persistent.
The idea is that the hash is going to be used a lot of times, so the
cost of creating it once doesn't matter too much.


diffs (67 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3162,7 +3162,13 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   rcost = (double) rci.ncand * 2 + lci.ncand * 1.1;
+   rcost = lci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash for
+* non-persistent bats */
+   if (rci.ncand != BATcount(r) || !(BBP_status(r->batCacheid) & 
BBPEXISTING) || r->theap.dirty || GDKinmemory())
+#endif
+   rcost += rci.ncand * 2.0;
} else {
if (rci.noids > 0) {
/* if we need to do binary search on candidate
@@ -3205,7 +3211,13 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   lcost = (double) lci.ncand * 2 + rci.ncand * 1.1;
+   lcost = rci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash
+* for non-persistent bats */
+   if (lci.ncand != BATcount(l) || 
!(BBP_status(l->batCacheid) & BBPEXISTING) || l->theap.dirty || GDKinmemory())
+#endif
+   lcost += lci.ncand * 2.0;
} else {
if (lci.noids > 0) {
/* if we need to do binary search on candidate
@@ -3501,9 +3513,13 @@ BATjoin(BAT **r1p, BAT **r2p, BAT *l, BA
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   lcost = (double) lci.ncand * 2 + rci.ncand * 1.1;
-   if (lci.ncand == BATcount(l) && !l->batTransient)
-   lcost *= 0.8;
+   lcost = rci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash for
+* non-persistent bats */
+   if (lci.ncand != BATcount(l) || !(BBP_status(l->batCacheid) & 
BBPEXISTING) || l->theap.dirty || GDKinmemory())
+#endif
+   lcost += lci.ncand * 2.0;
} else {
if (lci.noids > 0) {
/* if we need to do binary search on candidate
@@ -3542,9 +3558,13 @@ BATjoin(BAT **r1p, BAT **r2p, BAT *l, BA
/* no hash table, so cost includes time to build the
 * hash table (single scan) plus the time to do the
 * lookups (also single scan, we assume some chains) */
-   rcost = (double) rci.ncand * 2 + lci.ncand * 1.1;
-   if (rci.ncand == BATcount(r) && !r->batTransient)
-   rcost *= 0.8;
+   rcost = lci.ncand * 1.1;
+#ifdef PERSISTENTHASH
+   /* only count the cost of creating the hash for
+* non-persistent bats */
+   if (rci.ncand != BATcount(r) || !(BBP_status(r->batCacheid) & 
BBPEXISTING) || r->theap.dirty || GDKinmemory())
+#endif
+   rcost += rci.ncand * 2.0;
} else {
if (rci.noids > 0) {
/* if we need to do binary search on candidate
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Added trivial properties for some window func...

2020-05-15 Thread Pedro Ferreira
Changeset: be42eb07f760 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=be42eb07f760
Modified Files:
sql/backends/monet5/sql_rank.c
Branch: default
Log Message:

Added trivial properties for some window function cases


diffs (81 lines):

diff --git a/sql/backends/monet5/sql_rank.c b/sql/backends/monet5/sql_rank.c
--- a/sql/backends/monet5/sql_rank.c
+++ b/sql/backends/monet5/sql_rank.c
@@ -306,8 +306,12 @@ SQLrow_number(Client cntxt, MalBlkPtr mb
int icnt = (int) cnt;
for(j=1; j<=icnt; j++, rp++)
*rp = j;
+   r->tsorted = true;
+   r->tkey = true;
}
BATsetcount(r, cnt);
+   r->tnonil = true;
+   r->tnil = false;
BBPunfix(b->batCacheid);
BBPkeepref(*res = r->batCacheid);
} else {
@@ -393,9 +397,13 @@ SQLrank(Client cntxt, MalBlkPtr mb, MalS
int icnt = (int) cnt;
for(j=1; j<=icnt; j++, rp++)
*rp = j;
+   r->tsorted = true;
+   r->tkey = true;
}
}
BATsetcount(r, cnt);
+   r->tnonil = true;
+   r->tnil = false;
BBPunfix(b->batCacheid);
BBPkeepref(*res = r->batCacheid);
} else {
@@ -481,9 +489,13 @@ SQLdense_rank(Client cntxt, MalBlkPtr mb
int icnt = (int) cnt;
for(j=1; j<=icnt; j++, rp++)
*rp = j;
+   r->tsorted = true;
+   r->tkey = true;
}
}
BATsetcount(r, cnt);
+   r->tnonil = true;
+   r->tnil = false;
BBPunfix(b->batCacheid);
BBPkeepref(*res = r->batCacheid);
} else {
@@ -570,9 +582,13 @@ SQLpercent_rank(Client cntxt, MalBlkPtr 
} else { /* single value, ie no ordering - the outcome 
will always be 0 */
for(; rptsorted = true;
+   r->trevsorted = true;
}
}
BATsetcount(r, cnt);
+   r->tnonil = true;
+   r->tnil = false;
BBPunfix(b->batCacheid);
BBPkeepref(*res = r->batCacheid);
} else {
@@ -651,6 +667,8 @@ SQLcume_dist(Client cntxt, MalBlkPtr mb,
rp = rb + BATcount(b);
for (; rbtsorted = true;
+   r->trevsorted = true;
}
} else { /* single value, ie no partitions */
if (isaBatType(getArgType(mb, pci, 3))) {
@@ -677,9 +695,13 @@ SQLcume_dist(Client cntxt, MalBlkPtr mb,
rp = rb + BATcount(b);
for (; rbtsorted = true;
+   r->trevsorted = true;
}
}
BATsetcount(r, BATcount(b));
+   r->tnonil = true;
+   r->tnil = false;
BBPunfix(b->batCacheid);
BBPkeepref(*res = r->batCacheid);
} else {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list