MonetDB: Aug2018 - Per the guidelines, use pkgconfig(XXX) in Bui...

2018-08-22 Thread Sjoerd Mullender
Changeset: 24c431eb2619 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=24c431eb2619
Modified Files:
MonetDB.spec
NT/rules.msc
clients/examples/C/Makefile.ag
clients/mapiclient/Makefile.ag
common/stream/Makefile.ag
common/stream/monetdb-stream.pc.in
configure.ag
tools/merovingian/client/Makefile.ag
tools/merovingian/daemon/Makefile.ag
tools/mserver/Makefile.ag
Branch: Aug2018
Log Message:

Per the guidelines, use pkgconfig(XXX) in BuildRequires in spec file.
On RHEL 6, there is no pkgconfig(bzip2), so provide old code for that.
There is also no pkgconfig(atomic_ops) on RHEL 6, but in that case we
just don't use atomic_ops.


diffs (275 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -144,9 +144,9 @@ BuildRequires: selinux-policy-devel
 BuildRequires: hardlink
 %endif
 BuildRequires: bison
-BuildRequires: bzip2-devel
+BuildRequires: pkgconfig(bzip2)
 %if %{?with_fits:1}%{!?with_fits:0}
-BuildRequires: cfitsio-devel
+BuildRequires: pkgconfig(cfitsio)
 %endif
 BuildRequires: gcc
 %if %{?with_geos:1}%{!?with_geos:0}
@@ -154,25 +154,25 @@ BuildRequires: geos-devel >= 3.4.0
 %endif
 %if %{?with_lidar:1}%{!?with_lidar:0}
 BuildRequires: liblas-devel >= 1.8.0
-BuildRequires: gdal-devel
-BuildRequires: libgeotiff-devel
-# Fedora 22 liblas-devel does not depend on liblas:
-BuildRequires: liblas >= 1.8.0
+BuildRequires: pkgconfig(gdal)
 %endif
-BuildRequires: libatomic_ops-devel
-BuildRequires: libcurl-devel
-BuildRequires: xz-devel
+%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7
+# RHEL >= 7, and all current Fedora
+BuildRequires: pkgconfig(atomic_ops)
+%endif
+BuildRequires: pkgconfig(libcurl)
+BuildRequires: pkgconfig(liblzma)
 # BuildRequires: libmicrohttpd-devel
 BuildRequires: libuuid-devel
-BuildRequires: libxml2-devel
-BuildRequires: openssl-devel
+BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires: pkgconfig(openssl)
 %if %{?with_pcre:1}%{!?with_pcre:0}
-BuildRequires: pcre-devel >= 4.5
+BuildRequires: pkgconfig(libpcre) >= 4.5
 %endif
 BuildRequires: readline-devel
 BuildRequires: unixODBC-devel
 # BuildRequires: uriparser-devel
-BuildRequires: zlib-devel
+BuildRequires: pkgconfig(zlib)
 %if %{?with_samtools:1}%{!?with_samtools:0}
 BuildRequires: samtools-devel
 %endif
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -138,8 +138,8 @@ zlib_CFLAGS = -DHAVE_LIBZ "-I$(LIBZLIB)\
 !IFNDEF LIBBZIP2
 LIBBZIP2 = C:\bzip2-1.0.5.win$(bits)
 !ENDIF
-BZ_LIBS = "$(LIBBZIP2)\lib\libbz2.lib"
-BZ_CFLAGS = -DHAVE_LIBBZ2 "-I$(LIBBZIP2)\include"
+bzip2_LIBS = "$(LIBBZIP2)\lib\libbz2.lib"
+bzip2_CFLAGS = -DHAVE_LIBBZ2 "-I$(LIBBZIP2)\include"
 !ENDIF
 
 !IFDEF HAVE_LIBXML
diff --git a/clients/examples/C/Makefile.ag b/clients/examples/C/Makefile.ag
--- a/clients/examples/C/Makefile.ag
+++ b/clients/examples/C/Makefile.ag
@@ -14,5 +14,5 @@ BINS = {
smack00.c smack01.c
LIBS = ../../mapilib/libmapi \
../../../common/stream/libstream \
-   $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
+   $(SOCKET_LIBS) $(zlib_LIBS) $(bzip2_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
 }
diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag
--- a/clients/mapiclient/Makefile.ag
+++ b/clients/mapiclient/Makefile.ag
@@ -19,7 +19,7 @@ bin_mclient = {
../mapilib/libmapi \
../../common/stream/libstream \
$(READLINE_LIBS) \
-   $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
+   $(SOCKET_LIBS) $(zlib_LIBS) $(bzip2_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
 }
 
 bin_msqldump = {
@@ -27,7 +27,7 @@ bin_msqldump = {
LIBS = libmcutil ../../common/utils/libmutils \
../mapilib/libmapi \
../../common/stream/libstream \
-   $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
+   $(SOCKET_LIBS) $(zlib_LIBS) $(bzip2_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
 }
 
 bin_stethoscope = {
@@ -35,7 +35,7 @@ bin_stethoscope = {
LIBS = libmcutil ../../common/utils/libmutils \
../mapilib/libmapi \
../../common/stream/libstream \
-   $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
+   $(SOCKET_LIBS) $(zlib_LIBS) $(bzip2_LIBS) $(snappy_LIBS) 
$(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS)
 }
 
 bin_tachograph = {
@@ -43,7 +43,7 @@ bin_tachograph = {

MonetDB: Aug2018 - Possible unexpanded macro in: Requires: selin...

2018-08-22 Thread Sjoerd Mullender
Changeset: f9d739857dac for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f9d739857dac
Modified Files:
MonetDB.spec
Branch: Aug2018
Log Message:

Possible unexpanded macro in: Requires: selinux-policy >= 
%{_selinux_policy_version}


diffs (14 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -875,8 +875,8 @@ developer, but if you do want to test, t
 %package selinux
 Summary: SELinux policy files for MonetDB
 Group: Applications/Databases
-%if "%{_selinux_policy_version}" != ""
-Requires:   selinux-policy >= %{_selinux_policy_version}
+%if "%{?_selinux_policy_version}" != ""
+Requires:   selinux-policy >= %{?_selinux_policy_version}
 %endif
 Requires:   %{name}-SQL-server5 = %{version}-%{release}
 Requires(post):   /usr/sbin/semodule, /sbin/restorecon, /sbin/fixfiles, 
MonetDB-SQL-server5, MonetDB5-server
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: analytics - Merge with default

2018-08-22 Thread Pedro Ferreira
Changeset: fb5e798b348a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb5e798b348a
Added Files:
debian/libmonetdb17.install
Removed Files:
ChangeLog.Mar2018
buildtools/ChangeLog.Mar2018
clients/ChangeLog.Mar2018
clients/mapilib/ChangeLog.Mar2018
common/stream/ChangeLog.Mar2018
common/utils/ChangeLog.Mar2018
debian/libmonetdb16.install
gdk/ChangeLog.Mar2018
geom/ChangeLog.Mar2018
monetdb5/ChangeLog.Mar2018
sql/ChangeLog.Mar2018
testing/ChangeLog.Mar2018
tools/merovingian/ChangeLog.Mar2018
Modified Files:
.hgtags
MonetDB.spec
NT/mksqlwxs.py
NT/monetdb_config.h.in
NT/rules.msc
buildtools/ChangeLog-Archive
buildtools/ChangeLog.Aug2018
clients/ChangeLog-Archive
clients/ChangeLog.Aug2018
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
clients/mapiclient/dump.c
clients/mapiclient/mclient.c
clients/mapiclient/mhelp.c
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
common/stream/ChangeLog-Archive
common/stream/ChangeLog.Aug2018
common/stream/stream.c
common/stream/stream.h
configure.ag
debian/changelog
debian/control
gdk/ChangeLog
gdk/ChangeLog-Archive
gdk/ChangeLog.Aug2018
gdk/gdk.h
gdk/gdk_aggr.c
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_bbp.c
gdk/gdk_calc.c
gdk/gdk_calc.h
gdk/gdk_hash.c
gdk/gdk_heap.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_select.c
gdk/gdk_storage.c
gdk/gdk_system.c
gdk/gdk_system.h
gdk/gdk_tm.c
gdk/gdk_utils.c
gdk/gdk_utils.h
gdk/libbat.rc
geom/monetdb5/geom_upgrade.c
libversions
monetdb5/ChangeLog-Archive
monetdb5/ChangeLog.Aug2018
monetdb5/extras/rapi/rapi.c
monetdb5/extras/rapi/rapi.h
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_runtime.c
monetdb5/modules/kernel/aggr.c
monetdb5/modules/kernel/aggr.mal
monetdb5/modules/kernel/aggr.mal.sh
monetdb5/modules/kernel/algebra.mal
monetdb5/modules/kernel/bat5.c
monetdb5/modules/kernel/status.c
monetdb5/modules/mal/00_batcalc_hge.mal
monetdb5/modules/mal/00_batcalc_hge.mal.sh
monetdb5/modules/mal/01_batcalc.mal
monetdb5/modules/mal/01_batcalc.mal.sh
monetdb5/modules/mal/batcalc.c
monetdb5/modules/mal/calc.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/mat.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/wlc.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/tools/libmonetdb5.rc
sql/ChangeLog-Archive
sql/ChangeLog.Aug2018
sql/backends/monet5/UDF/capi/capi.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/server/rel_psm.c
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_utils.c
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.sql

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
testing/ChangeLog-Archive
testing/ChangeLog.Aug2018
tools/merovingian/ChangeLog-Archive
tools/merovingian/ChangeLog.Aug2018
tools/mserver/mserver5.c
tools/mserver/shutdowntest.c
vertoo.data
Branch: analytics
Log Message:

Merge with default


diffs (truncated from 6532 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -701,3 +701,8 @@ e96bb94b4c9c3b99e1c33d9c8b49bc3ce7f8e95b
 ee3d17d6f39930280f5aa914b42b87cda09008ca Mar2018_SP1_release
 e96bb94b4c9c3b99e1c33d9c8b49bc3ce7f8e95b Mar2018_SP1_release
 44182a802530768278cf750fd93c829acdde29f1 Aug2018_root
+9c824ea44063e239b7251dce71f9af741c682211 Aug2018_1
+9c824ea44063e239b7251dce71f9af741c682211 Aug2018_release
+2d06f2ece18a5718d9cbab6e7ad64ace6b7d95bd Aug2018_3
+9c824ea44063e239b7251dce71f9af741c682211 Aug2018_release
+2d06f2ece18a5718d9cbab6e7ad64ace6b7d95bd Aug2018_release
diff --git a/ChangeLog.Mar2018 b/ChangeLog.Mar2018
deleted file mode 100644
--- a/ChangeLog.Mar2018
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for devel
-# This file is updated with Maddlog
-
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -132,7 +132,7 @@ Vendor: MonetDB BV 
 Group: 

MonetDB: analytics - Cleaned SQLsum and SQLprod implementations.

2018-08-22 Thread Pedro Ferreira
Changeset: a57bb0d1a461 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a57bb0d1a461
Modified Files:
sql/backends/monet5/sql_rank.c
sql/backends/monet5/sql_rank.h
sql/backends/monet5/sql_rank.mal
sql/backends/monet5/sql_rank.mal.sh
sql/backends/monet5/sql_rank_hge.mal
sql/backends/monet5/sql_rank_hge.mal.sh
Branch: analytics
Log Message:

Cleaned SQLsum and SQLprod implementations.


diffs (truncated from 531 to 300 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
@@ -737,10 +737,9 @@ SQLcount_no_nil(Client cntxt, MalBlkPtr 
 
 static str
 do_analytical_sumprod(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci,
- gdk_return (*func)(BAT *, BAT *, BAT 
*, BAT *, int, int), int tpe, const str op, const str err)
+ gdk_return (*func)(BAT *, BAT *, BAT 
*, BAT *, int, int), const str op, const str err)
 {
-   BAT *r, *b, *p, *o;
-   str msg = SQLanalytics_args(, , , , cntxt, mb, stk, pci, tpe, 
op, err);
+   BAT *r = NULL, *b = NULL, *p = NULL, *o = NULL;
int tp1 = getArgType(mb, pci, 1), tp2;
int unit = *getArgReference_int(stk, pci, 4);
int start = *getArgReference_int(stk, pci, 5);
@@ -748,19 +747,73 @@ do_analytical_sumprod(Client cntxt, MalB
int excl = *getArgReference_int(stk, pci, 7);
gdk_return gdk_res;
 
+   (void) cntxt;
+   if (pci->argc != 8 ||
+   (getArgType(mb, pci, 2) != TYPE_bit && 
getBatType(getArgType(mb, pci, 2)) != TYPE_bit) ||
+   (getArgType(mb, pci, 3) != TYPE_bit && 
getBatType(getArgType(mb, pci, 3)) != TYPE_bit)) {
+   throw(SQL, op, "%s", err);
+   }
+   if (isaBatType(tp1))
+   tp1 = getBatType(tp1);
+   if (isaBatType(getArgType(mb, pci, 1))) {
+   b = BATdescriptor(*getArgReference_bat(stk, pci, 1));
+   if (!b)
+   throw(SQL, op, SQLSTATE(HY005) "Cannot access column 
descriptor");
+   }
+   switch (tp1) {
+   case TYPE_bte:
+   case TYPE_sht:
+   case TYPE_int:
+   case TYPE_lng:
+#ifdef HAVE_HGE
+   case TYPE_hge:
+#endif
+#ifdef HAVE_HGE
+   tp2 = TYPE_hge;
+#else
+   tp2 = TYPE_lng;
+#endif
+   break;
+   case TYPE_flt:
+   tp2 = TYPE_flt;
+   break;
+   case TYPE_dbl:
+   tp2 = TYPE_dbl;
+   break;
+   default: {
+   if(b) BBPunfix(b->batCacheid);
+   throw(SQL, op, SQLSTATE(42000) "%s not available for 
%s", op, ATOMname(tp1));
+   }
+   }
+   if (b) {
+   BUN cnt = BATcount(b);
+   voidresultBAT(r, tp2, cnt, b, op);
+   }
+   if (isaBatType(getArgType(mb, pci, 2))) {
+   p = BATdescriptor(*getArgReference_bat(stk, pci, 2));
+   if (!p) {
+   if (b) BBPunfix(b->batCacheid);
+   if (r) BBPunfix(r->batCacheid);
+   throw(SQL, op, SQLSTATE(HY005) "Cannot access column 
descriptor");
+   }
+   }
+   if (isaBatType(getArgType(mb, pci, 3))) {
+   o = BATdescriptor(*getArgReference_bat(stk, pci, 3));
+   if (!o) {
+   if (b) BBPunfix(b->batCacheid);
+   if (r) BBPunfix(r->batCacheid);
+   if (p) BBPunfix(p->batCacheid);
+   throw(SQL, op, SQLSTATE(HY005) "Cannot access column 
descriptor");
+   }
+   }
+
if (unit != 0 || excl != 0)
throw(SQL, op, SQLSTATE(42000) "OVER currently only supports 
frame extends with unit ROWS (and none of the excludes)");
(void) start;
(void) end;
 
-   if (msg)
-   return msg;
-   if (isaBatType(tp1))
-   tp1 = getBatType(tp1);
-
if (b) {
bat *res = getArgReference_bat(stk, pci, 0);
-   tp2 = getBatType(r->T.type);
 
gdk_res = func(r, b, p, o, tp1, tp2);
BBPunfix(b->batCacheid);
@@ -773,59 +826,21 @@ do_analytical_sumprod(Client cntxt, MalB
ptr *in = getArgReference(stk, pci, 1);
*res = *in;
}
-   return msg;
+   return MAL_SUCCEED;
 }
 
 str
-SQLscalarsum(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+SQLsum(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
-   ValPtr ret = >stk[getArg(pci, 0)];
-   return do_analytical_sumprod(cntxt, mb, stk, pci, GDKanalyticalsum, 
ret->vtype,
-"sql.sum", 

MonetDB: Aug2018 - Added liblzma conditional; sorted for ease of...

2018-08-22 Thread Sjoerd Mullender
Changeset: 4b17c85c035c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4b17c85c035c
Modified Files:
NT/rules.msc
Branch: Aug2018
Log Message:

Added liblzma conditional; sorted for ease of maintenance.


diffs (63 lines):

diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -284,11 +284,6 @@ create_winconfig_conds_new_py:
 !ELSE
$(ECHO) CROSS_COMPILING_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
-!IFDEF HAVE_FITS
-   $(ECHO) HAVE_FITS_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ELSE
-   $(ECHO) HAVE_FITS_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ENDIF
 !IFDEF HAVE_CURL
$(ECHO) HAVE_CURL_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ELSE
@@ -299,6 +294,11 @@ create_winconfig_conds_new_py:
 !ELSE
$(ECHO) HAVE_DEVELOPER_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
+!IFDEF HAVE_FITS
+   $(ECHO) HAVE_FITS_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ELSE
+   $(ECHO) HAVE_FITS_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ENDIF
 !IFDEF HAVE_GDK
$(ECHO) HAVE_GDK_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ELSE
@@ -319,6 +319,11 @@ create_winconfig_conds_new_py:
 !ELSE
$(ECHO) HAVE_LIBBZ2_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
+!IFDEF HAVE_LIBLZMA
+   $(ECHO) HAVE_LIBLZMA_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ELSE
+   $(ECHO) HAVE_LIBLZMA_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ENDIF
 !IFDEF HAVE_LIBPY
$(ECHO) HAVE_LIBPY_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ELSE
@@ -349,11 +354,6 @@ create_winconfig_conds_new_py:
 !ELSE
$(ECHO) HAVE_LIDAR_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
-!IFDEF HAVE_SHP
-   $(ECHO) HAVE_SHP_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ELSE
-   $(ECHO) HAVE_SHP_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ENDIF
 !IFDEF HAVE_MONETDB5
$(ECHO) HAVE_MONETDB5_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ELSE
@@ -399,6 +399,11 @@ create_winconfig_conds_new_py:
 !ELSE
$(ECHO) HAVE_SAMTOOLS_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
+!IFDEF HAVE_SHP
+   $(ECHO) HAVE_SHP_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ELSE
+   $(ECHO) HAVE_SHP_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ENDIF
 !IFDEF HAVE_SQL
$(ECHO) HAVE_SQL_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ELSE
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: analytics - Eliminated identical branches, plus use BUN...

2018-08-22 Thread Pedro Ferreira
Changeset: 9c723d2a480b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9c723d2a480b
Modified Files:
gdk/gdk_analytic.c
sql/backends/monet5/sql_rank.c
Branch: analytics
Log Message:

Eliminated identical branches, plus use BUN for BATcount.


diffs (truncated from 1154 to 300 lines):

diff --git a/gdk/gdk_analytic.c b/gdk/gdk_analytic.c
--- a/gdk/gdk_analytic.c
+++ b/gdk/gdk_analytic.c
@@ -213,49 +213,26 @@ finish:
curval = *bp;\
end = rp + cnt;  \
if (p) { \
-   if (o) { \
-   np = (bit*)Tloc(p, 0);   \
-   for(; rptnonil = !has_nils;  
\
-   r->tnil = has_nils; 
\
-   return gdk_res; 
\
+#define ANALYTICAL_LIMIT(OP, IMP, SIGN_OP) 
   \
+gdk_return 
   \
+GDKanalytical##OP(BAT *r, BAT *b, BAT *p, BAT *o, int tpe) 
   \
+{  
   \
+   int (*atomcmp)(const void *, const void *); 
  \
+   const void *nil;
  \
+   bool has_nils = false;  
  \
+   BUN i, j, cnt = BATcount(b);
  \
+   bit *restrict np;   
  \
+   gdk_return gdk_res = GDK_SUCCEED;   
  \
+   
   \
+   switch(ATOMstorage(tpe)) {  
  \
+   case TYPE_bit:  
  \
+   ANALYTICAL_LIMIT_IMP(bit, IMP)  
  \
+   break;  
  \
+   case TYPE_bte:  
  \
+   ANALYTICAL_LIMIT_IMP(bte, IMP)  
  \
+   break;  
  \
+   case TYPE_sht:  
  \
+   ANALYTICAL_LIMIT_IMP(sht, IMP)  
  \
+   break;  
  \
+   case TYPE_int:  
  \
+   ANALYTICAL_LIMIT_IMP(int, IMP)  
  \
+   break;  
  \
+   case TYPE_lng:  
  \
+   ANALYTICAL_LIMIT_IMP(lng, IMP)  
  \
+   break;  
  \
+   ANALYTICAL_LIMIT_IMP_HUGE(IMP)  
  \
+   case TYPE_flt:  
  \
+   ANALYTICAL_LIMIT_IMP(flt, IMP)  
  \
+   break;  
  \
+   case TYPE_dbl:  
  \
+   ANALYTICAL_LIMIT_IMP(dbl, IMP)  
  \
+   break;  
  \
+   default: {  
  \
+   BATiter bpi = bat_iterator(b);  
  \
+   void *restrict curval = BUNtail(bpi, 0);
  \
+   nil = ATOMnilptr(tpe);  
  \
+

MonetDB: analytics - Implemented ntile(n) over a window.

2018-08-22 Thread Pedro Ferreira
Changeset: 0237b8aad4ed for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0237b8aad4ed
Modified Files:
gdk/gdk_analytic.c
gdk/gdk_analytic.h
sql/backends/monet5/sql_rank.c
sql/backends/monet5/sql_rank.h
sql/backends/monet5/sql_rank.mal
sql/backends/monet5/sql_rank.mal.sh
sql/backends/monet5/sql_rank_hge.mal
sql/backends/monet5/sql_rank_hge.mal.sh
sql/common/sql_types.c
sql/server/rel_select.c
sql/server/sql_parser.y
sql/server/sql_scan.c
sql/test/analytics/Tests/analytics01.sql
sql/test/analytics/Tests/analytics01.stable.out
Branch: analytics
Log Message:

Implemented ntile(n) over a window.

Now it's time for a cleanup.


diffs (truncated from 1071 to 300 lines):

diff --git a/gdk/gdk_analytic.c b/gdk/gdk_analytic.c
--- a/gdk/gdk_analytic.c
+++ b/gdk/gdk_analytic.c
@@ -101,6 +101,110 @@ GDKanalyticaldiff(BAT *r, BAT *b, BAT *c
 
 #undef ANALYTICAL_DIFF_IMP
 
+#define NTILE_CALC(TPE)   \
+   do {  \
+   TPE val =  *(TPE *)ntile; \
+   if((BUN)val >= cnt) { \
+   i = 1;\
+   for(; rbtnonil = true;
+   r->tnil = false;
+   if(o) {
+   r->tsorted = o->tsorted;
+   r->trevsorted = o->trevsorted;
+   } else if(!p) {
+   r->tsorted = true;
+   r->trevsorted = false;
+   }
+   return gdk_res;
+}
+
+#undef ANALYTICAL_NTILE_IMP
+#undef NTILE_CALC
+
 #define ANALYTICAL_LIMIT_IMP(TPE, OP)\
do { \
TPE *rp, *rb, *restrict bp, *end, curval;\
diff --git a/gdk/gdk_analytic.h b/gdk/gdk_analytic.h
--- a/gdk/gdk_analytic.h
+++ b/gdk/gdk_analytic.h
@@ -17,6 +17,7 @@
 #include "gdk.h"
 
 gdk_export gdk_return GDKanalyticaldiff(BAT *r, BAT *b, BAT *c, int tpe);
+gdk_export gdk_return GDKanalyticalntile(BAT *r, BAT *b, BAT *p, BAT *o, int 
tpe, ptr ntile);
 gdk_export gdk_return GDKanalyticalmin(BAT *r, BAT *b, BAT *p, BAT *o, int 
tpe);
 gdk_export gdk_return GDKanalyticalmax(BAT *r, BAT *b, BAT *p, BAT *o, int 
tpe);
 gdk_export gdk_return GDKanalyticalcount(BAT *r, BAT *b, BAT *p, BAT *o, const 
bit *ignore_nils, int tpe);
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
@@ -399,7 +399,7 @@ SQLcume_dist(Client cntxt, MalBlkPtr mb,
p = BATdescriptor(*getArgReference_bat(stk, 
pci, 2));
if (!p) {
BBPunfix(b->batCacheid);
-   throw(SQL, "sql.percent_rank", 
SQLSTATE(HY005) "Cannot access column descriptor");
+   throw(SQL, "sql.cume_dist", 
SQLSTATE(HY005) "Cannot access column descriptor");
}
np = (bit*)Tloc(p, 0);
for(j=0; rpbatCacheid);
-   throw(SQL, "sql.percent_rank", 
SQLSTATE(HY005) "Cannot access column descriptor");
+   throw(SQL, "sql.cume_dist", 
SQLSTATE(HY005) "Cannot access column descriptor");
}
np = (bit*)Tloc(p, 0);
for(j=0; rpbatCacheid);
\
+   throw(SQL, "sql.ntile", SQLSTATE(42000) "ntile must be 
greater than zero"); \
+   }   
\
+   voidresultBAT(r, TYPE_##TPE, cnt, b, "sql.ntile");  
\
+   if (isaBatType(getArgType(mb, pci, 3))) {   
\
+   p = BATdescriptor(*getArgReference_bat(stk, pci, 3));   
\
+   if (!p) {   
\
+   BBPunfix(b->batCacheid);
\
+   throw(SQL, "sql.ntile", SQLSTATE(HY005) "Cannot 
access column descriptor"); \
+   }   
\
+   }   
\
+   if (isaBatType(getArgType(mb, pci, 4))) {   
\
+   o = BATdescriptor(*getArgReference_bat(stk, pci, 4));   
\
+   if (!o) {