Changeset: 9a005a3efffe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a005a3efffe Added Files: sql/ChangeLog.linear-hashing Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out debian/control gdk/gdk_aggr.c geom/sql/functions/Tests/ST_IsSimple.stable.out monetdb5/mal/mal_client.c monetdb5/modules/kernel/alarm.c monetdb5/modules/kernel/alarm.mal monetdb5/modules/mal/clients.c monetdb5/modules/mal/clients.h monetdb5/modules/mal/clients.mal monetdb5/modules/mal/sysmon.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_upgrades.c sql/rel.txt sql/scripts/22_clients.sql sql/scripts/25_debug.sql sql/scripts/26_sysmon.sql sql/server/rel_select.c sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out sql/test/BugTracker-2010/Tests/TypeException_with_missing_function.Bug-2674.stable.err sql/test/BugTracker-2012/Tests/create_function.Bug-3172.stable.err sql/test/BugTracker-2012/Tests/table_function_with_column_subselects.Bug-3172.stable.err sql/test/BugTracker-2012/Tests/table_returning_func_returns_too_many_columns.Bug-3077.stable.err sql/test/BugTracker-2013/Tests/psm_functions_and_accessrights.Bug-3300.stable.err sql/test/BugTracker-2016/Tests/invalidcolumns.Bug-3968.stable.err sql/test/BugTracker-2017/Tests/udf_crash_subquery_scalar_paramters.Bug-6399.stable.err sql/test/BugTracker-2018/Tests/crash-after-call-non-existing-loader.stable.err sql/test/Tests/drop-function-if-exists.stable.err sql/test/Users/Tests/sessioncontrol.stable.err 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 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 sql/test/miscellaneous/Tests/simple_selects.sql sql/test/miscellaneous/Tests/simple_selects.stable.err sql/test/sys-schema/Tests/systemfunctions.stable.out sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 testing/Mtest.py.in Branch: json Log Message:
Merge with default diffs (truncated from 3881 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -565,9 +565,9 @@ stdout of test 'MAL-signatures` in direc [ "aggr", "variancep", "command aggr.variancep(b:bat[:any_2]):dbl ", "ALGvariancep;", "Gives the variance of all tail values" ] [ "alarm", "ctime", "unsafe command alarm.ctime():str ", "ALARMctime;", "Return the current time as a C-time string." ] [ "alarm", "epoch", "unsafe command alarm.epoch():int ", "ALARMepoch;", "Return time since Jan 1, 1970 in seconds." ] -[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:bat[:int]):bat[:int] ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] -[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:int):int ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] -[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:int):void ", "ALARMsleep;", "Sleep a few milliseconds" ] +[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:any_1):any_1 ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] +[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:any_1):void ", "ALARMsleep;", "Sleep a few milliseconds" ] +[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:bat[:any_1]):bat[:any_1] ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] [ "alarm", "time", "unsafe command alarm.time():int ", "ALARMtime;", "Return time since program start in milliseconds." ] [ "alarm", "usec", "unsafe command alarm.usec():lng ", "ALARMusec;", "Return time since Jan 1, 1970 in microseconds." ] [ "algebra", "antijoin", "function algebra.antijoin(l:bat[:any_1], r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], nil_matches:bit, estimate:lng) (X_0:bat[:oid], X_1:bat[:oid]);", "", "" ] @@ -10466,7 +10466,7 @@ stdout of test 'MAL-signatures` in direc [ "clients", "stopsession", "pattern clients.stopsession(sid:int):void ", "CLTstopSession;", "Stop a particular session" ] [ "clients", "stopsession", "pattern clients.stopsession(sid:sht):void ", "CLTstopSession;", "" ] [ "clients", "suspend", "pattern clients.suspend(id:int):void ", "CLTsuspend;", "Put a client process to sleep for some time.\nIt will simple sleep for a second at a time, until\nthe awake bit has been set in its descriptor" ] -[ "clients", "wakeup", "command clients.wakeup(id:int):void ", "CLTwakeup;", "Wakeup a client process" ] +[ "clients", "wakeup", "pattern clients.wakeup(id:int):void ", "CLTwakeup;", "Wakeup a client process" ] [ "color", "#fromstr", "command color.#fromstr():void ", "color_fromstr;", "" ] [ "color", "#tostr", "command color.#tostr():void ", "color_tostr;", "" ] [ "color", "blue", "command color.blue(c:color):int ", "CLRblue;", "Extracts blue component from a color atom" ] diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -674,9 +674,9 @@ stdout of test 'MAL-signatures` in direc [ "aggr", "variancep", "command aggr.variancep(b:bat[:any_2]):dbl ", "ALGvariancep;", "Gives the variance of all tail values" ] [ "alarm", "ctime", "unsafe command alarm.ctime():str ", "ALARMctime;", "Return the current time as a C-time string." ] [ "alarm", "epoch", "unsafe command alarm.epoch():int ", "ALARMepoch;", "Return time since Jan 1, 1970 in seconds." ] -[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:bat[:int]):bat[:int] ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] -[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:int):int ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] -[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:int):void ", "ALARMsleep;", "Sleep a few milliseconds" ] +[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:any_1):any_1 ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] +[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:any_1):void ", "ALARMsleep;", "Sleep a few milliseconds" ] +[ "alarm", "sleep", "unsafe pattern alarm.sleep(msecs:bat[:any_1]):bat[:any_1] ", "ALARMsleep;", "Sleep a few milliseconds and return the slept value" ] [ "alarm", "time", "unsafe command alarm.time():int ", "ALARMtime;", "Return time since program start in milliseconds." ] [ "alarm", "usec", "unsafe command alarm.usec():lng ", "ALARMusec;", "Return time since Jan 1, 1970 in microseconds." ] [ "algebra", "antijoin", "function algebra.antijoin(l:bat[:any_1], r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], nil_matches:bit, estimate:lng) (X_0:bat[:oid], X_1:bat[:oid]);", "", "" ] @@ -14872,7 +14872,7 @@ stdout of test 'MAL-signatures` in direc [ "clients", "stopsession", "pattern clients.stopsession(sid:int):void ", "CLTstopSession;", "Stop a particular session" ] [ "clients", "stopsession", "pattern clients.stopsession(sid:sht):void ", "CLTstopSession;", "" ] [ "clients", "suspend", "pattern clients.suspend(id:int):void ", "CLTsuspend;", "Put a client process to sleep for some time.\nIt will simple sleep for a second at a time, until\nthe awake bit has been set in its descriptor" ] -[ "clients", "wakeup", "command clients.wakeup(id:int):void ", "CLTwakeup;", "Wakeup a client process" ] +[ "clients", "wakeup", "pattern clients.wakeup(id:int):void ", "CLTwakeup;", "Wakeup a client process" ] [ "color", "#fromstr", "command color.#fromstr():void ", "color_fromstr;", "" ] [ "color", "#tostr", "command color.#tostr():void ", "color_tostr;", "" ] [ "color", "blue", "command color.blue(c:color):int ", "CLRblue;", "Extracts blue component from a color atom" ] 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 @@ -992,7 +992,7 @@ str CLTshutdown(Client cntxt, MalBlkPtr str CLTstop(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CLTstopSession(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CLTsuspend(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -str CLTwakeup(void *ret, int *id); +str CLTwakeup(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CMDBATimprints(void *ret, bat *bid); str CMDBATimprintsize(lng *ret, bat *bid); str CMDBATnew(Client cntxt, MalBlkPtr m, MalStkPtr s, InstrPtr p); diff --git a/debian/control b/debian/control --- a/debian/control +++ b/debian/control @@ -252,7 +252,7 @@ Description: MonetDB5 128 bit integer (h Package: monetdb-python3 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - monetdb5-sql (= ${source:Version}) + monetdb5-sql (= ${source:Version}), python3-numpy Description: Integration of MonetDB and Python, allowing use of Python from within SQL MonetDB is a database management system that is developed from a main-memory perspective with use of a fully decomposed storage model, @@ -269,7 +269,7 @@ Description: Integration of MonetDB and Package: monetdb-r Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - monetdb5-sql (= ${source:Version}) + monetdb5-sql (= ${source:Version}), r-base-core Description: Integration of MonetDB and R, allowing use of R from within SQL MonetDB is a database management system that is developed from a main-memory perspective with use of a fully decomposed storage model, diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -3595,14 +3595,20 @@ dogroupcovariance(BAT *b1, BAT *b2, BAT delta1 = GDKmalloc(ngrp * sizeof(dbl)); delta2 = GDKmalloc(ngrp * sizeof(dbl)); - m2 = GDKzalloc(ngrp * sizeof(dbl)); + m2 = GDKmalloc(ngrp * sizeof(dbl)); cnts = GDKzalloc(ngrp * sizeof(BUN)); - mean1 = GDKzalloc(ngrp * sizeof(dbl)); - mean2 = GDKzalloc(ngrp * sizeof(dbl)); + mean1 = GDKmalloc(ngrp * sizeof(dbl)); + mean2 = GDKmalloc(ngrp * sizeof(dbl)); if (mean1 == NULL || mean2 == NULL || delta1 == NULL || delta2 == NULL || m2 == NULL || cnts == NULL) goto alloc_fail; + for (i = 0; i < ngrp; i++) { + m2[i] = 0; + mean1[i] = 0; + mean2[i] = 0; + } + bn = COLnew(min, TYPE_dbl, ngrp, TRANSIENT); if (bn == NULL) goto alloc_fail; @@ -3767,16 +3773,24 @@ BATgroupcorrelation(BAT *b1, BAT *b2, BA delta1 = GDKmalloc(ngrp * sizeof(dbl)); delta2 = GDKmalloc(ngrp * sizeof(dbl)); - up = GDKzalloc(ngrp * sizeof(dbl)); - down1 = GDKzalloc(ngrp * sizeof(dbl)); - down2 = GDKzalloc(ngrp * sizeof(dbl)); + up = GDKmalloc(ngrp * sizeof(dbl)); + down1 = GDKmalloc(ngrp * sizeof(dbl)); + down2 = GDKmalloc(ngrp * sizeof(dbl)); cnts = GDKzalloc(ngrp * sizeof(BUN)); - mean1 = GDKzalloc(ngrp * sizeof(dbl)); - mean2 = GDKzalloc(ngrp * sizeof(dbl)); + mean1 = GDKmalloc(ngrp * sizeof(dbl)); + mean2 = GDKmalloc(ngrp * sizeof(dbl)); if (mean1 == NULL || mean2 == NULL || delta1 == NULL || delta2 == NULL || up == NULL || down1 == NULL || down2 == NULL || cnts == NULL) goto alloc_fail; + for (i = 0; i < ngrp; i++) { + up[i] = 0; + down1[i] = 0; + down2[i] = 0; + mean1[i] = 0; + mean2[i] = 0; + } + bn = COLnew(min, TYPE_dbl, ngrp, TRANSIENT); if (bn == NULL) goto alloc_fail; diff --git a/geom/sql/functions/Tests/ST_IsSimple.stable.out b/geom/sql/functions/Tests/ST_IsSimple.stable.out --- a/geom/sql/functions/Tests/ST_IsSimple.stable.out +++ b/geom/sql/functions/Tests/ST_IsSimple.stable.out @@ -28,7 +28,7 @@ stdout of test 'ST_IsSimple` in director % %1 # name % boolean # type % 5 # length -[ true ] +[ false ] #SELECT ST_IsSimple(ST_GeomFromText('LINESTRING(1 1,2 2,2 3.5,1 3,1 2,2 1)')); % . # table_name % %1 # name @@ -43,7 +43,7 @@ stdout of test 'ST_IsSimple` in director % %1 # name % boolean # type % 5 # length -[ true ] +[ false ] #drop table geo; #create table geo (g geometry(linestring, 4326)); #insert into geo values(ST_GeomFromText('LINESTRING(1 1,2 2,2 3.5,1 3,1 2,2 1)', 4326)); 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 @@ -605,7 +605,6 @@ MCreadClient(Client c) return 1; } - int MCvalid(Client tc) { diff --git a/monetdb5/modules/kernel/alarm.c b/monetdb5/modules/kernel/alarm.c --- a/monetdb5/modules/kernel/alarm.c +++ b/monetdb5/modules/kernel/alarm.c @@ -39,57 +39,95 @@ ALARMusec(lng *ret) return MAL_SUCCEED; } +#define SLEEP_SINGLE(TPE) \ + do { \ + TPE *res = (TPE*) getArgReference(stk, pci, 0), *msecs = (TPE*) getArgReference(stk,pci,1); \ + if (is_##TPE##_nil(*msecs)) \ + throw(MAL, "alarm.sleepr", "NULL values not allowed for sleeping time"); \ + if (*msecs < 0) \ + throw(MAL, "alarm.sleepr", "Cannot sleep for a negative time"); \ + MT_sleep_ms((unsigned int) *msecs); \ + *res = *msecs; \ + } while (0) + +#define SLEEP_MULTI(TPE) \ + do { \ + for (i = 0; i < j ; i++) { \ + if (is_##TPE##_nil(bb[i])) { \ + BBPreclaim(r); \ + BBPunfix(b->batCacheid); \ + throw(MAL, "alarm.sleepr", "NULL values not allowed for sleeping time"); \ + } \ + if (bb[i] < 0) { \ + BBPreclaim(r); \ + BBPunfix(b->batCacheid); \ + throw(MAL, "alarm.sleepr", "Cannot sleep for a negative time"); \ + } \ + } \ + for (i = 0; i < j ; i++) { \ + MT_sleep_ms((unsigned int) bb[i]); \ + rb[i] = bb[i]; \ + } \ + } while (0) + str ALARMsleep(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - BAT *r, *b; - int *restrict rb, *restrict bb; + BAT *r = NULL, *b = NULL; + int *restrict rb, *restrict bb, tpe; BUN i, j; (void) cntxt; if (getArgType(mb, pci, 0) != TYPE_void && isaBatType(getArgType(mb, pci, 1))) { bat *res = getArgReference_bat(stk, pci, 0); bat *bid = getArgReference_bat(stk, pci, 1); - + tpe = getArgType(mb, pci, 1); + if (!(b = BATdescriptor(*bid))) throw(MAL, "alarm.sleepr", SQLSTATE(HY005) "Cannot access column descriptor"); j = BATcount(b); bb = Tloc(b, 0); - for (i = 0; i < j ; i++) { - if (is_int_nil(bb[i])) { - BBPunfix(b->batCacheid); - throw(MAL, "alarm.sleepr", "NULL values not allowed for the sleeping time"); - } else if (bb[i]) { - BBPunfix(b->batCacheid); - throw(MAL, "alarm.sleepr", "Cannot sleep for a negative time"); - } - } - r = COLnew(0, TYPE_int, j, TRANSIENT); - if (r == NULL) { + if (!(r = COLnew(0, tpe, j, TRANSIENT))) { BBPunfix(b->batCacheid); throw(MAL, "alarm.sleepr", SQLSTATE(HY013) MAL_MALLOC_FAIL); } + rb = Tloc(r, 0); - rb = Tloc(r, 0); - for (i = 0; i < j ; i++) { - MT_sleep_ms(bb[i]); - rb[i] = bb[i]; + switch (tpe) { + case TYPE_bte: + SLEEP_MULTI(bte); + break; + case TYPE_sht: + SLEEP_MULTI(sht); + break; + case TYPE_int: + SLEEP_MULTI(int); + break; + default: { + BBPreclaim(r); + BBPunfix(b->batCacheid); + throw(MAL, "alarm.sleepr", SQLSTATE(42000) "Sleep function not available for type %s", ATOMname(tpe)); + } } BBPunfix(b->batCacheid); BBPkeepref(*res = r->batCacheid); } else { - int *res = (int*) getArgReference(stk, pci, 0), *msecs = (int*) getArgReference(stk,pci,1); - - if (is_int_nil(*msecs)) - throw(MAL, "alarm.sleepr", "NULL values not allowed for the sleeping time"); - else if (*msecs < 0) - throw(MAL, "alarm.sleepr", "Cannot sleep for a negative time"); - - MT_sleep_ms(*msecs); - *res = *msecs; + switch (getArgType(mb, pci, 1)) { + case TYPE_bte: + SLEEP_SINGLE(bte); + break; + case TYPE_sht: + SLEEP_SINGLE(sht); + break; + case TYPE_int: + SLEEP_SINGLE(int); + break; + default: + throw(MAL, "alarm.sleepr", SQLSTATE(42000) "Sleep function not available for type %s", ATOMname(getArgType(mb, pci, 1))); + } } return MAL_SUCCEED; } diff --git a/monetdb5/modules/kernel/alarm.mal b/monetdb5/modules/kernel/alarm.mal --- a/monetdb5/modules/kernel/alarm.mal _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list