Changeset: 1f7f1b21df01 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f7f1b21df01
Added Files:
sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.sql
sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql
sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.err
sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.out
Modified Files:
gdk/gdk_atoms.c
gdk/gdk_storage.c
gdk/gdk_system.c
sql/server/rel_select.c
sql/test/BugTracker-2017/Tests/All
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
sql/test/mergetables/Tests/All
Branch: default
Log Message:
Merge with Jul2017 branch.
diffs (truncated from 413 to 300 lines):
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1152,19 +1152,15 @@ strHash(const char *s)
void
strCleanHash(Heap *h, int rebuild)
{
- char oldhash[GDK_STRHASHSIZE];
+ stridx_t newhash[GDK_STRHASHTABLE];
size_t pad, pos;
const size_t extralen = h->hashash ? EXTRALEN : 0;
- stridx_t *bucket;
BUN off, strhash;
const char *s;
(void) rebuild;
if (!h->cleanhash)
return;
- /* copy old hash table so we can check whether we changed it */
- memcpy(oldhash, h->base, sizeof(oldhash));
- h->cleanhash = 0;
/* rebuild hash table for double elimination
*
* If appending strings to the BAT was aborted, if the heap
@@ -1175,7 +1171,7 @@ strCleanHash(Heap *h, int rebuild)
* Note that we will only do this the first time the heap is
* loaded, and only for heaps that existed when the server was
* started. */
- memset(h->base, 0, GDK_STRHASHSIZE);
+ memset(newhash, 0, sizeof(newhash));
pos = GDK_STRHASHSIZE;
while (pos < h->free && pos < GDK_ELIMLIMIT) {
pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1));
@@ -1188,8 +1184,7 @@ strCleanHash(Heap *h, int rebuild)
else
GDK_STRHASH(s, strhash);
off = strhash & GDK_STRHASHMASK;
- bucket = ((stridx_t *) h->base) + off;
- *bucket = (stridx_t) (pos - extralen - sizeof(stridx_t));
+ newhash[off] = (stridx_t) (pos - extralen - sizeof(stridx_t));
pos += GDK_STRLEN(s);
}
#ifndef NDEBUG
@@ -1207,13 +1202,14 @@ strCleanHash(Heap *h, int rebuild)
}
#endif
/* only set dirty flag if the hash table actually changed */
- if (!h->dirty &&
- memcmp(oldhash, h->base, sizeof(oldhash)) != 0) {
- if (h->storage == STORE_MMAP)
+ if (memcmp(newhash, h->base, sizeof(newhash)) != 0) {
+ memcpy(h->base, newhash, sizeof(newhash));
+ if (h->storage == STORE_MMAP) {
(void) MT_msync(h->base, GDK_STRHASHSIZE);
- else
+ } else
h->dirty = 1;
}
+ h->cleanhash = 0;
}
/*
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -621,7 +621,6 @@ DESCload(int i)
return NULL;
}
b->ttype = tt;
- b->thash = NULL;
/* reconstruct mode from BBP status (BATmode doesn't flush
* descriptor, so loaded mode may be stale) */
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -435,7 +435,7 @@ find_posthread_locked(pthread_t tid)
struct posthread *p;
for (p = posthreads; p; p = p->next)
- if (p->tid == tid)
+ if (pthread_equal(p->tid, tid))
return p;
return NULL;
}
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
@@ -2139,6 +2139,32 @@ rel_logical_value_exp(mvc *sql, sql_rel
if (l)
st = exp_subtype(l);
}
+ if (l && !r && !n->next) { /* possibly a (not)
in function call */
+ /* reset error */
+ sql->session->status = 0;
+ sql->errstr[0] = 0;
+
+ z = left;
+ r = rel_value_exp(sql, &z, sval, f,
ek);
+ if (z == left && r) {
+ sql_subfunc *f = NULL;
+
+ l = rel_check_type(sql,
exp_subtype(r), l, type_equal);
+ if (!l)
+ return NULL;
+ f = sql_bind_func(sql->sa,
sql->session->schema, "=", exp_subtype(l), exp_subtype(r), F_FUNC);
+ if (f)
+ l = exp_binop(sql->sa,
l, r, f);
+ if (f && l && sc->token ==
SQL_NOT_IN) {
+ f =
sql_bind_func(sql->sa, sql->session->schema, "not", exp_subtype(l), NULL,
F_FUNC);
+ return
exp_unop(sql->sa, l, f);
+ } else if (f && l && sc->token
== SQL_IN) {
+ return l;
+ }
+
+ }
+ r = NULL;
+ }
if (!l || !r || !(r=rel_check_type(sql, st, r,
type_equal))) {
rel_destroy(right);
return NULL;
diff --git a/sql/test/BugTracker-2017/Tests/All
b/sql/test/BugTracker-2017/Tests/All
--- a/sql/test/BugTracker-2017/Tests/All
+++ b/sql/test/BugTracker-2017/Tests/All
@@ -114,3 +114,4 @@ HAVE_GEOM?sqlsmith.Bug-6477
crash-in-topn.Bug-6478
function-resolution.Bug-6436
generate-resolution.Bug-6471
+sqlitelogictest-select-in-column.Bug-6490
diff --git
a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
--- a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
+++ b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
@@ -27,10 +27,6 @@ stderr of test 'crash_in_in_handling.Bug
# 14:07:27 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-29945" "--port=39677"
# 14:07:27 >
-MAPI = (monetdb) /var/tmp/mtest-29945/.s.monetdb.39677
-QUERY = SELECT * FROM tab0 AS cor0 WHERE NOT NULL IN ( col3 );
-ERROR = !SELECT: identifier 'col3' unknown
-CODE = 42000
# 14:07:27 >
# 14:07:27 > "Done."
diff --git
a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
--- a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
+++ b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
@@ -45,6 +45,11 @@ Ready.
[ 1 ]
#INSERT INTO tab0 VALUES(9,501,776.40,'cvygg',725,75.5,'etlyv');
[ 1 ]
+#SELECT * FROM tab0 AS cor0 WHERE NOT NULL IN ( col3 );
+% sys.cor0, sys.cor0, sys.cor0, sys.cor0, sys.cor0,
sys.cor0, sys.cor0 # table_name
+% pk, col0, col1, col2, col3, col4, col5 # name
+% int, int, double, clob, int, double, clob # type
+% 1, 1, 24, 0, 1, 24, 0 # length
#drop table tab0;
# 14:07:27 >
diff --git
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.sql
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.sql
new file mode 100644
--- /dev/null
+++
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.sql
@@ -0,0 +1,6 @@
+CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2 TEXT,
col3 INTEGER, col4 FLOAT, col5 TEXT);
+SELECT ALL * FROM tab0 AS cor0 WHERE NOT CAST ( NULL AS INTEGER ) NOT IN (
col3 / col1 );
+SELECT ALL * FROM tab0 AS cor0 WHERE NOT NULL IN ( col0, 59 + col4, + col1 );
+SELECT + - COUNT ( * ) FROM tab0 WHERE NOT NULL NOT IN ( - col0, 4 );
+SELECT * FROM tab0 AS cor0 WHERE NOT ( NULL ) IN ( - col3 + - 33 + + + col4 +
+ 54, - 51 + col4 );
+DROP TABLE tab0;
diff --git
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
new file mode 100644
--- /dev/null
+++
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'sqlitelogictest-select-in-column.Bug-6490` in directory
'sql/test/BugTracker-2017` itself:
+
+
+# 23:22:13 >
+# 23:22:13 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=34932" "--set"
"mapi_usock=/var/tmp/mtest-13741/.s.monetdb.34932" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 23:22:13 >
+
+# builtin opt gdk_dbpath =
/home/niels/scratch/rc-monetdb/Linux-x86_64/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
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 34932
+# cmdline opt mapi_usock = /var/tmp/mtest-13741/.s.monetdb.34932
+# cmdline opt monet_prompt =
+# cmdline opt gdk_dbpath =
/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017
+# cmdline opt gdk_debug = 536870922
+
+# 23:22:13 >
+# 23:22:13 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-13741" "--port=34932"
+# 23:22:13 >
+
+
+# 23:22:13 >
+# 23:22:13 > "Done."
+# 23:22:13 >
+
diff --git
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
new file mode 100644
--- /dev/null
+++
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
@@ -0,0 +1,38 @@
+stdout of test 'sqlitelogictest-select-in-column.Bug-6490` in directory
'sql/test/BugTracker-2017` itself:
+
+
+# 23:22:13 >
+# 23:22:13 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=34932" "--set"
"mapi_usock=/var/tmp/mtest-13741/.s.monetdb.34932" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 23:22:13 >
+
+# MonetDB 5 server v11.27.6
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2017', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 7.330 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:34932/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-13741/.s.monetdb.34932
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 23:22:13 >
+# 23:22:13 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-13741" "--port=34932"
+# 23:22:13 >
+
+#CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2
TEXT, col3 INTEGER, col4 FLOAT, col5 TEXT);
+#SELECT ALL * FROM tab0 AS cor0 WHERE NOT CAST ( NULL AS INTEGER ) NOT IN (
col3 / col1 );
+% sys.cor0, sys.cor0, sys.cor0, sys.cor0, sys.cor0,
sys.cor0, sys.cor0 # table_name
+% pk, col0, col1, col2, col3, col4, col5 # name
+% int, int, double, clob, int, double, clob # type
+% 1, 1, 24, 0, 1, 24, 0 # length
+#DROP TABLE tab0;
+
+# 23:22:13 >
+# 23:22:13 > "Done."
+# 23:22:13 >
+
diff --git a/sql/test/mergetables/Tests/All b/sql/test/mergetables/Tests/All
--- a/sql/test/mergetables/Tests/All
+++ b/sql/test/mergetables/Tests/All
@@ -30,4 +30,6 @@ HAVE_GEOM?sqlsmith.Bug-6459
HAVE_NETCDF?sqlsmith-exist-lateral
HAVE_NETCDF?sqlsmith-apply-outer-join-or
HAVE_NETCDF?sqlsmith.Bug-6472
+sqlsmith.Bug-6480
mergedb_drop
+
diff --git a/sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql
b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql
@@ -0,0 +1,46 @@
+select
+ 64 as c0,
+ ref_12.y as c1,
+ ref_12.y as c2,
+ case when true then ref_12.z else ref_12.z end
+ as c3,
+ cast(coalesce(ref_12.b,
+ ref_12.b) as boolean) as c4,
+ ref_12.x as c5
+from
+ sys.s as ref_12
+where EXISTS (
+ select
+ ref_17.keyword as c0,
+ subq_0.c5 as c1,
+ ref_12.x as c2,
+ subq_0.c1 as c3,
+ ref_17.keyword as c4,
+ subq_0.c6 as c5,
+ ref_17.keyword as c6,
+ subq_0.c9 as c7,
+ ref_12.z as c8,
+ ref_12.y as c9,
+ 23 as c10,
+ subq_0.c1 as c11
+ from
+ sys.keywords as ref_17
+ left join (select
+ ref_19.y as c0,
+ ref_12.x as c1,
+ ref_19.z as c2,
+ ref_19.y as c3,
+ ref_12.z as c4,
+ ref_12.y as c5,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list