Changeset: 908eca0d6097 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=908eca0d6097
Added Files:
        
sql/test/BugTracker-2012/Tests/table_returning_func_returns_too_many_columns.Bug-3077.sql
        
sql/test/BugTracker-2012/Tests/table_returning_func_returns_too_many_columns.Bug-3077.stable.err
        
sql/test/BugTracker-2012/Tests/table_returning_func_returns_too_many_columns.Bug-3077.stable.out
Modified Files:
        NT/monetdb_config.h.in
        clients/mapiclient/mclient.c
        configure.ag
        gdk/Makefile.ag
        gdk/gdk_posix.c
        gdk/gdk_system.c
        gdk/gdk_utils.c
        sql/backends/monet5/UDF/udf.c
        sql/jdbc/tests/Tests/Test_Dobjects.stable.out
        sql/jdbc/tests/Tests/Test_JdbcClient.stable.out
        
sql/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.stable.out
        
sql/test/BugTracker-2008/Tests/sql_command_kills_db.SF-2233677.stable.err
        sql/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out
        
sql/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out
        sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.stable.out
        sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out
        
sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.stable.out
        sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err
        sql/test/BugTracker/Tests/multi-column-constraint.SF-1964587.stable.out
        sql/test/BugTracker/Tests/rank_over.SF-1691098.stable.out
        sql/test/BugTracker/Tests/with_only_once.SF-1720293.stable.out
        sql/test/Dump/Tests/dump-empty.stable.out
        sql/test/Dump/Tests/dump.stable.out
        sql/test/Dump/Tests/dump.stable.out.Windows
        sql/test/UserDump/Tests/create.stable.out
        sql/test/bugs/Tests/groupby_having_charlength-bug-sf-943566.stable.out
        sql/test/bugs/Tests/insert_delete-bug-sf-904025.stable.out
        sql/test/bugs/Tests/simple_view.stable.out
        
sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
        sql/test/concurrent/Tests/crash_on_concurrent_use.SF-1411926.stable.out
        sql/test/leaks/Tests/check0.stable.out
        sql/test/leaks/Tests/check1.stable.out
        sql/test/leaks/Tests/check2.stable.out
        sql/test/leaks/Tests/check3.stable.out
        sql/test/leaks/Tests/check4.stable.out
        sql/test/leaks/Tests/check5.stable.out
        sql/test/leaks/Tests/drop3.stable.out
        sql/test/leaks/Tests/select1.stable.out
        sql/test/leaks/Tests/select2.stable.out
        sql/test/leaks/Tests/temp1.stable.out
        sql/test/leaks/Tests/temp2.stable.out
        sql/test/leaks/Tests/temp3.stable.out
        sql/test/mapi/Tests/php_monetdb.stable.out
        sql/test/sciql/Tests/01_create_01.stable.out
Branch: sciql
Log Message:

merged from default


diffs (truncated from 2023 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -171,27 +171,15 @@
 /* Define to 1 if you have the `getopt_long' function. */
 /* #undef HAVE_GETOPT_LONG */
 
-/* Define to 1 if you have the `GetProcessMemoryInfo' function. */
-#define HAVE_GETPROCESSMEMORYINFO 1
-
 /* Define to 1 if you have the `getrlimit' function. */
 /* #undef HAVE_GETRLIMIT */
 
-/* Define to 1 if you have the `GetSystemInfo' function. */
-#define HAVE_GETSYSTEMINFO 1
-
 /* Define to 1 if you have the `gettimeofday' function. */
 /* #undef HAVE_GETTIMEOFDAY */
 
 /* Define to 1 if you have the `getuid' function. */
 /* #undef HAVE_GETUID */
 
-/* Define to 1 if you have the `GlobalMemoryStatus' function. */
-#define HAVE_GLOBALMEMORYSTATUS 1
-
-/* Define to 1 if you have the `GlobalMemoryStatusEx' function. */
-#define HAVE_GLOBALMEMORYSTATUSEX 1 /* only on >= NT 5 */
-
 /* Define if you have the iconv() function and it works. */
 /* #undef HAVE_ICONV */                /* optionally defined in rules.msc */
 
@@ -383,9 +371,6 @@
 /* Define to 1 if you have the <pwd.h> header file. */
 /* #undef HAVE_PWD_H */
 
-/* Define to 1 if you have the `QueryPerformanceCounter' function. */
-#define HAVE_QUERYPERFORMANCECOUNTER 1
-
 /* Define if you have the raptor library */
 /* #undef HAVE_RAPTOR */
 
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -207,7 +207,7 @@ gettime(void)
 {
        /* Return the time in milliseconds since an epoch.  The epoch
           is roughly the time this program started. */
-#ifdef HAVE_QUERYPERFORMANCECOUNTER
+#ifdef _MSC_VER
        static LARGE_INTEGER freq, start;       /* automatically initialized to 
0 */
        LARGE_INTEGER ctr;
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1507,7 +1507,6 @@ mac*)
        QDIRSEP='\\'
        PATHSEP=';'
        SOEXT='-0.dll'
-       AC_DEFINE([HAVE_GLOBALMEMORYSTATUS], 1, [Define to 1 if you have the 
`GlobalMemoryStatus' function.])
        ;;
 *cygwin*)
        DIRSEP='/'
@@ -2628,8 +2627,6 @@ AC_CHECK_FUNCS([\
                                GetSystemInfo \
                                gettimeofday \
                                getuid \
-                               GlobalMemoryStatus \
-                               GlobalMemoryStatusEx \
                                isinf \
                                kill \
                                localtime_r \
@@ -2642,7 +2639,6 @@ AC_CHECK_FUNCS([\
                                posix_fadvise \
                                posix_madvise \
                                putenv \
-                               QueryPerformanceCounter \
                                round \
                                sbrk \
                                setenv \
diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -50,5 +50,5 @@ lib_gdk = {
                ../common/stream/libstream \
                ../common/utils/libmutils \
                $(MATH_LIBS) $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) \
-               $(MALLOC_LIBS) $(PTHREAD_LIBS) $(DL_LIBS)
+               $(MALLOC_LIBS) $(PTHREAD_LIBS) $(DL_LIBS) $(PSAPILIB)
 }
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -742,12 +742,7 @@ MT_init_posix(void)
 size_t
 MT_getrss(void)
 {
-#ifdef HAVE_GETPROCESSMEMORYINFO
-       PROCESS_MEMORY_COUNTERS ctr;
-
-       if (GetProcessMemoryInfo(GetCurrentProcess(), &ctr, sizeof(ctr)))
-               return ctr.WorkingSetSize;
-#elif defined(HAVE_PROCFS_H) && defined(__sun__)
+#if defined(HAVE_PROCFS_H) && defined(__sun__)
        /* retrieve RSS the Solaris way (2.6+) */
        static char MT_mmap_procfile[128] = { 0 };
        int fd;
@@ -966,6 +961,7 @@ mdlopen(const char *library, int mode)
 #ifdef _MSC_VER
 #include <io.h>
 #endif /* _MSC_VER */
+#include <Psapi.h>
 
 #define MT_SMALLBLOCK 256
 
@@ -987,18 +983,11 @@ MT_init_posix(void)
 size_t
 MT_getrss()
 {
-#if (_WIN32_WINNT >= 0x0500)
-       MEMORYSTATUSEX state;
+       PROCESS_MEMORY_COUNTERS ctr;
 
-       state.dwLength = sizeof(state);
-       GlobalMemoryStatusEx(&state);
-       return (size_t) (state.ullTotalPhys - state.ullAvailPhys);
-#else
-       MEMORYSTATUS state;
-
-       GlobalMemoryStatus(&state);
-       return state.dwTotalPhys - state.dwAvailPhys;
-#endif
+       if (GetProcessMemoryInfo(GetCurrentProcess(), &ctr, sizeof(ctr)))
+               return ctr.WorkingSetSize;
+       return 0;
 }
 
 char *
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -691,7 +691,7 @@ GDKusec(void)
 {
        /* Return the time in milliseconds since an epoch.  The epoch
           is roughly the time this program started. */
-#ifdef HAVE_QUERYPERFORMANCECOUNTER
+#ifdef _MSC_VER
        static LARGE_INTEGER freq, start;       /* automatically initialized to 
0 */
        LARGE_INTEGER ctr;
 
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -347,7 +347,7 @@ size_t _MT_npages = 0;              /* variable hold
 void
 MT_init(void)
 {
-#ifdef HAVE_GETSYSTEMINFO
+#ifdef _MSC_VER
        {
                SYSTEM_INFO sysInfo;
 
@@ -373,7 +373,7 @@ MT_init(void)
        if (_MT_pagesize <= 0)
                _MT_pagesize = 4096;    /* default */
 
-#ifdef HAVE_GLOBALMEMORYSTATUSEX
+#ifdef _MSC_VER
        {
                MEMORYSTATUSEX memStatEx;
 
@@ -381,13 +381,6 @@ MT_init(void)
                if (GlobalMemoryStatusEx(&memStatEx))
                        _MT_npages = (size_t) (memStatEx.ullTotalPhys / 
_MT_pagesize);
        }
-#elif defined(HAVE_GLOBALMEMORYSTATUS)
-       if (_MT_npages <= 0) {
-               MEMORYSTATUS memStat;
-
-               GlobalMemoryStatus(&memStat);
-               _MT_npages = memStat.dwTotalPhys / _MT_pagesize;
-       }
 #elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_MEMSIZE) && SIZEOF_SIZE_T == 
SIZEOF_LNG
        /* Darwin, 64-bits */
        {
diff --git a/sql/backends/monet5/UDF/udf.c b/sql/backends/monet5/UDF/udf.c
--- a/sql/backends/monet5/UDF/udf.c
+++ b/sql/backends/monet5/UDF/udf.c
@@ -146,7 +146,7 @@ UDFBATreverse_(BAT **ret, BAT *left)
        return MAL_SUCCEED;
 }
 
-/* MAL wrapper */           
+/* MAL wrapper */
 str
 UDFBATreverse(bat *ret, bat *bid)
 {
@@ -178,11 +178,12 @@ UDFBATreverse(bat *ret, bat *bid)
 
 /* scalar fuse */
 
-/* using C macro for convenient type-expansion */
+/* use C macro to conveniently define type-specific functions */
 #define UDFfuse_scalar_impl(in,uin,out,shift)                          \
 /* fuse two (shift-byte) in values into one (2*shift-byte) out value */        
\
 /* actual implementation */                                            \
-static str UDFfuse_##in##_##out##_ ( out *ret , in one , in two )      \
+static str                                                             \
+UDFfuse_##in##_##out##_ ( out *ret , in one , in two )                 \
 {                                                                      \
        /* assert calling sanity */                                     \
        assert(ret != NULL);                                            \
@@ -197,7 +198,8 @@ static str UDFfuse_##in##_##out##_ ( out
        return MAL_SUCCEED;                                             \
 }                                                                      \
 /* MAL wrapper */                                                      \
-str UDFfuse_##in##_##out ( out *ret , in *one , in *two )              \
+str                                                                    \
+UDFfuse_##in##_##out ( out *ret , in *one , in *two )                  \
 {                                                                      \
        /* assert calling sanity */                                     \
        assert(ret != NULL && one != NULL && two != NULL);              \
@@ -205,6 +207,7 @@ str UDFfuse_##in##_##out ( out *ret , in
        return UDFfuse_##in##_##out##_ ( ret, *one, *two );             \
 }
 
+/* call C macro to define type-specific functions */
 UDFfuse_scalar_impl(bte, unsigned char,  sht,  8)
 UDFfuse_scalar_impl(sht, unsigned short, int, 16)
 UDFfuse_scalar_impl(int, unsigned int,   lng, 32)
@@ -216,6 +219,51 @@ UDFfuse_scalar_impl(int, unsigned int,  
  * accessing value arrays directly.
  */
 
+/* type-specific core algorithm */
+/* use C macro to conveniently define type-specific functions */
+#define UDFBATfuse_impl(in,uin,out,shift)                              \
+static str                                                             \
+UDFBATfuse_##in##_##out ( BAT *bres, BAT *bone, BAT *btwo, BUN n,      \
+                            bit *two_tail_sorted_unsigned,             \
+                            bit *two_tail_revsorted_unsigned )         \
+{                                                                      \
+       in *one = NULL, *two = NULL;                                    \
+       out *res = NULL;                                                \
+       BUN i;                                                          \
+                                                                       \
+       /* assert calling sanity */                                     \
+       assert(bres != NULL && bone != NULL && btwo != NULL);           \
+       assert(BATcapacity(bres) >= n);                                 \
+       assert(BATcount(bone) >= n && BATcount(btwo) >= n);             \
+       assert(bone->ttype == TYPE_##in && btwo->ttype == TYPE_##in);   \
+       assert(bres->ttype == TYPE_##out);                              \
+                                                                       \
+       /* get direct access to the tail arrays */                      \
+       one = (in *) Tloc(bone, BUNfirst(bone));                        \
+       two = (in *) Tloc(btwo, BUNfirst(btwo));                        \
+       res = (out*) Tloc(bres, BUNfirst(bres));                        \
+       /* iterate over all values/tuples and do the work */            \
+       for (i = 0; i < n; i++)                                         \
+               if (one[i] == in##_nil || two[i] == in##_nil)           \
+                       /* NULL/nil in => NULL/nil out */               \
+                       res[i] = out##_nil;                             \
+               else                                                    \
+                       /* do the work; watch out for sign bits */      \
+                       res[i] = ((out) (uin) one[i] << shift) | (uin) two[i]; \
+                                                                       \
+       *two_tail_sorted_unsigned =                                     \
+               BATtordered(btwo) && (two[0] >= 0 || two[n-1] < 0);     \
+       *two_tail_revsorted_unsigned =                                  \
+               BATtrevordered(btwo) && (two[0] < 0 || two[n-1] >= 0);  \
+                                                                       \
+       return MAL_SUCCEED;                                             \
+}
+
+/* call C macro to define type-specific functions */
+UDFBATfuse_impl(bte, unsigned char,  sht,  8)
+UDFBATfuse_impl(sht, unsigned short, int, 16)
+UDFBATfuse_impl(int, unsigned int,   lng, 32)
+
 /* actual implementation */
 static str
 UDFBATfuse_(BAT **ret, BAT *bone, BAT *btwo)
@@ -223,6 +271,8 @@ UDFBATfuse_(BAT **ret, BAT *bone, BAT *b
        BAT *bres = NULL;
        bit two_tail_sorted_unsigned = FALSE;
        bit two_tail_revsorted_unsigned = FALSE;
+       BUN n;
+       str msg = NULL;
 
        /* assert calling sanity */
        assert(ret != NULL);
@@ -239,6 +289,7 @@ UDFBATfuse_(BAT **ret, BAT *bone, BAT *b
                throw(MAL, "batudf.fuse",
                      "heads of input BATs must be aligned");
        }
+       n = BATcount(bone);
 
        /* check tail types */
        if (bone->ttype != btwo->ttype) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to