Changeset: 121908b6d78c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=121908b6d78c
Added Files:
sql/test/BugTracker-2018/Tests/All
sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.sql
sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.err
sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.out
Modified Files:
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
gdk/libbat.rc
monetdb5/mal/mal_profiler.c
monetdb5/modules/kernel/algebra.c
monetdb5/tools/libmonetdb5.rc
sql/backends/monet5/UDF/pyapi/conversion.c
sql/server/rel_optimizer.c
sql/test/BugTracker/Tests/explain.SF-1739353.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
sql/test/Dependencies/Tests/Dependencies.stable.out
sql/test/Dependencies/Tests/Dependencies.stable.out.int128
sql/test/rdf/Tests/create_tables_v.stable.out
sql/test/rdf/Tests/drop_tables_v.stable.out
Branch: comment-on
Log Message:
Merge changes from branch 'default' into 'comment-on'
diffs (truncated from 1104 to 300 lines):
diff --git a/clients/mapilib/mapi.rc b/clients/mapilib/mapi.rc
--- a/clients/mapilib/mapi.rc
+++ b/clients/mapilib/mapi.rc
@@ -23,7 +23,7 @@ BEGIN
// Maintained via vertoo. Please don't modify by hand!
// Contact [email protected] for details and/or
assistance.
VALUE "InternalName", "Mapi\0"
- VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2017\0"
+ VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2018\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Mapi.dll\0"
VALUE "PrivateBuild", "\0"
diff --git a/clients/odbc/driver/driver.rc b/clients/odbc/driver/driver.rc
--- a/clients/odbc/driver/driver.rc
+++ b/clients/odbc/driver/driver.rc
@@ -23,7 +23,7 @@ BEGIN
// Maintained via vertoo. Please don't modify by hand!
// Contact [email protected] for details and/or
assistance.
VALUE "InternalName", "libMonetODBC\0"
- VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2017\0"
+ VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2018\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libMonetODBC.dll\0"
VALUE "PrivateBuild", "\0"
diff --git a/clients/odbc/winsetup/setup.rc b/clients/odbc/winsetup/setup.rc
--- a/clients/odbc/winsetup/setup.rc
+++ b/clients/odbc/winsetup/setup.rc
@@ -82,7 +82,7 @@ BEGIN
VALUE "FileDescription", "MonetDB ODBC Setup DLL"
VALUE "FileVersion", "11.28.0"
VALUE "InternalName", "libMonetODBCs.dll"
- VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2017"
+ VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2018"
VALUE "OriginalFilename", "libMonetODBCs.dll"
VALUE "ProductName", "MonetDB SQL Server"
VALUE "ProductVersion", "11.28.0"
diff --git a/gdk/libbat.rc b/gdk/libbat.rc
--- a/gdk/libbat.rc
+++ b/gdk/libbat.rc
@@ -23,7 +23,7 @@ BEGIN
// Maintained via vertoo. Please don't modify by hand!
// Contact [email protected] for details and/or
assistance.
VALUE "InternalName", "libbat\0"
- VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2017\0"
+ VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2018\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libbat.dll\0"
VALUE "PrivateBuild", "\0"
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -139,6 +139,7 @@ EXAMPLE:
static void
renderProfilerEvent(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int start, str
usrname)
{
+ (void)usrname;
char logbuffer[LOGLEN], *logbase;
size_t loglen;
str stmt, c;
@@ -158,9 +159,7 @@ renderProfilerEvent(MalBlkPtr mb, MalStk
/* make profile event tuple */
lognew();
logadd("{%s",prettify); // fill in later with the event counter
-
- if( usrname)
- //logadd("\"user\":\"%s\",%s",usrname, prettify);
+ logadd("\"source\": \"trace\"%s", prettify);
logadd("\"clk\":"LLFMT",%s",usec,prettify);
logadd("\"ctime\":"LLFMT".%06ld,%s", sec, microseconds, prettify);
@@ -384,10 +383,10 @@ getCPULoad(char cpuload[BUFSIZ]){
static FILE *proc= NULL;
lng newload;
- if ( proc == NULL || ferror(proc))
+ if (proc == NULL || ferror(proc))
proc = fopen("/proc/stat","r");
else rewind(proc);
- if ( proc == NULL) {
+ if (proc == NULL) {
/* unexpected */
return -1;
}
@@ -395,10 +394,10 @@ getCPULoad(char cpuload[BUFSIZ]){
if ((n = fread(buf, 1, BUFSIZ,proc)) == 0 )
return -1;
buf[n] = 0;
- for ( s= buf; *s; s++) {
- if ( strncmp(s,"cpu",3)== 0){
+ for (s= buf; *s; s++) {
+ if (strncmp(s,"cpu",3)== 0){
s +=3;
- if ( *s == ' ') {
+ if (*s == ' ') {
s++;
cpu = 255; // the cpu totals stored here
} else {
@@ -428,12 +427,12 @@ getCPULoad(char cpuload[BUFSIZ]){
s++;
}
- if( cpuload == 0)
+ if(cpuload == 0)
return 0;
// identify core processing
- len += snprintf(cpuload, BUFSIZ, "[ ");
- for ( cpu = 0; cpuload && cpu < 255 && corestat[cpu].user; cpu++) {
- len +=snprintf(cpuload + len, BUFSIZ - len, "%c %.2f",
(cpu?',':' '), corestat[cpu].load);
+ len += snprintf(cpuload, BUFSIZ, "[");
+ for (cpu = 0; cpuload && cpu < 255 && corestat[cpu].user; cpu++) {
+ len +=snprintf(cpuload + len, BUFSIZ - len, "%s%.2f",
(cpu?",":""), corestat[cpu].load);
}
(void) snprintf(cpuload + len, BUFSIZ - len, "]");
return 0;
@@ -455,7 +454,7 @@ profilerHeartbeatEvent(char *alter)
lognew();
logadd("{%s",prettify); // fill in later with the event counter
- logadd("\"user\":\"heartbeat\",%s", prettify);
+ logadd("\"source\":\"heartbeat\",%s", prettify);
logadd("\"rss\":"SZFMT ",%s", MT_getrss()/1024/1024, prettify);
#ifdef HAVE_SYS_RESOURCE_H
getrusage(RUSAGE_SELF, &infoUsage);
@@ -472,7 +471,7 @@ profilerHeartbeatEvent(char *alter)
prevUsage = infoUsage;
#endif
logadd("\"state\":\"%s\",%s",alter,prettify);
- logadd("\"cpuload\":\"%s\",%s",cpuload,prettify);
+ logadd("\"cpuload\":%s%s",cpuload,prettify);
logadd("}\n"); // end marker
logjsonInternal(logbuffer);
}
diff --git a/monetdb5/modules/kernel/algebra.c
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -508,7 +508,7 @@ ALGintersect(bat *r1, const bat *lid, co
{
return do_join(r1, NULL, lid, rid, NULL, slid, srid, 0, NULL, NULL, 0,
0,
nil_matches, estimate,
- BATsemijoin, NULL, NULL, NULL, NULL,
"algebra.difference");
+ BATsemijoin, NULL, NULL, NULL, NULL,
"algebra.intersect");
}
/* algebra.firstn(b:bat[:any],
diff --git a/monetdb5/tools/libmonetdb5.rc b/monetdb5/tools/libmonetdb5.rc
--- a/monetdb5/tools/libmonetdb5.rc
+++ b/monetdb5/tools/libmonetdb5.rc
@@ -23,7 +23,7 @@ BEGIN
// Maintained via vertoo. Please don't modify by hand!
// Contact [email protected] for details and/or
assistance.
VALUE "InternalName", "libmonetdb5\0"
- VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2017\0"
+ VALUE "LegalCopyright", "Copyright © MonetDB B.V. 2008-2018\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libmonetdb5.dll\0"
VALUE "PrivateBuild", "\0"
diff --git a/sql/backends/monet5/UDF/pyapi/conversion.c
b/sql/backends/monet5/UDF/pyapi/conversion.c
--- a/sql/backends/monet5/UDF/pyapi/conversion.c
+++ b/sql/backends/monet5/UDF/pyapi/conversion.c
@@ -92,7 +92,7 @@ wrapup:
PyObject *PyMaskedArray_FromBAT(PyInput *inp, size_t t_start, size_t t_end,
char
**return_message, bool copy)
{
- BAT *b = inp->bat;
+ BAT *b;
char *msg;
PyObject *vararray;
@@ -100,6 +100,7 @@ PyObject *PyMaskedArray_FromBAT(PyInput
if (vararray == NULL) {
return NULL;
}
+ b = inp->bat;
// To deal with null values, we use the numpy masked array structure
// The masked array structure is an object with two arrays of equal
size, a
// data array and a mask array
@@ -183,13 +184,10 @@ PyObject *PyArrayObject_FromBAT(PyInput
SQLSTATE(PY000) "Failed to convert BAT.");
goto wrapup;
}
- BBPunfix(inp->bat->batCacheid);
- inp->bat = ret_bat;
+ b = ret_bat;
}
}
- b = inp->bat;
-
if (IsBlobType(inp->bat_type)) {
PyObject **data;
li = bat_iterator(b);
@@ -396,9 +394,13 @@ PyObject *PyArrayObject_FromBAT(PyInput
SQLSTATE(PY000)
"Failed to convert BAT to Numpy array.");
goto wrapup;
}
+ if (b != inp->bat)
+ BBPunfix(b->batCacheid);
return vararray;
wrapup:
*return_message = msg;
+ if (b != inp->bat)
+ BBPunfix(b->batCacheid);
return NULL;
}
@@ -407,7 +409,7 @@ wrapup:
tpe *bat_ptr = (tpe *)b->theap.base;
\
for (j = 0; j < count; j++) {
\
mask_data[j] = is_##tpe##_nil(bat_ptr[j]);
\
- found_nil = found_nil || mask_data[j];
\
+ found_nil |= mask_data[j];
\
}
\
}
@@ -425,7 +427,7 @@ PyObject *PyNullMask_FromBAT(BAT *b, siz
BATiter bi = bat_iterator(b);
bool *mask_data = (bool *)PyArray_DATA(nullmask);
- switch (ATOMstorage(getBatType(b->ttype))) {
+ switch (ATOMbasetype(getBatType(b->ttype))) {
case TYPE_bit:
CreateNullMask(bit);
break;
@@ -456,7 +458,7 @@ PyObject *PyNullMask_FromBAT(BAT *b, siz
int (*atomcmp)(const void *, const void *) =
ATOMcompare(b->ttype);
for (j = 0; j < count; j++) {
mask_data[j] = (*atomcmp)(BUNtail(bi,
(BUN)(j)), nil) == 0;
- found_nil = found_nil || mask_data[j];
+ found_nil |= mask_data[j];
}
}
}
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -8862,13 +8862,6 @@ rel_apply_rewrite(int *changes, mvc *sql
exp_label(sql->sa, col,
++sql->label);
append(r->exps, col);
}
- /*
- } else if (is_semi(rl->op)) {
- sql_rel *l = rl->l;
- if (!is_project(l->op))
- rl->l = l =
rel_project(sql->sa, l, rel_projections(sql, l, NULL, 1, 1));
- col = l->exps->t->data;
- */
} else if (!is_project(rl->op)) {
rl = rel_project(sql->sa, rl,
rel_projections(sql, rl, NULL, 1, 1));
r->l = rl;
diff --git a/sql/test/BugTracker-2018/Tests/All
b/sql/test/BugTracker-2018/Tests/All
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2018/Tests/All
@@ -0,0 +1,1 @@
+HAVE_LIBPY?pyUDF-crash.Bug-6508
diff --git a/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.sql
b/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.sql
@@ -0,0 +1,18 @@
+CREATE FUNCTION test_timestamp_with_nulls(actual_takeoff_datetime timestamp)
+RETURNS STRING LANGUAGE PYTHON {
+ import json
+ return json.dumps(actual_takeoff_datetime.tolist());
+};
+
+
+CREATE TABLE example (
+ "column1" timestamp
+);
+
+insert into example ("column1") values ('2017-01-01 00:00:01');
+insert into example ("column1") values (NULL);
+
+select test_timestamp_with_nulls("column1") from example;
+
+drop table example;
+drop function test_timestamp_with_nulls(timestamp);
diff --git a/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.err
b/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'pyUDF-crash.Bug-6508` in directory 'sql/test/BugTracker-2018`
itself:
+
+
+# 10:14:58 >
+# 10:14:58 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=34466" "--set"
"mapi_usock=/var/tmp/mtest-10982/.s.monetdb.34466" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2018"
"--set" "embedded_py=true"
+# 10:14:58 >
+
+# builtin opt gdk_dbpath = /ufs/sjoerd/@Monet-stable/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list