Changeset: 3d34c0219ae0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3d34c0219ae0
Modified Files:
sql/src/backends/monet5/sql.mx
sql/src/benchmarks/tpch/Tests/01-22.stable.out
sql/src/benchmarks/tpch/Tests/16.stable.out
sql/src/server/rel_optimizer.mx
sql/src/server/rel_schema.mx
sql/src/server/rel_select.mx
sql/src/server/rel_semantic.mx
sql/src/test/BugTracker-2010/Tests/copy-into-too-long-string.Bug-2358.sql
sql/src/test/BugTracker-2010/Tests/duplicate-key.Bug-2667.stable.err
sql/src/test/BugTracker-2010/Tests/multiple-common-table-expressions.Bug-2664.stable.out
sql/src/test/BugTracker-2010/Tests/not-in-union-except-union.Bug-2577.stable.out
sql/src/test/BugTracker-2010/Tests/slow-query.Bug-2671.stable.out
sql/src/test/BugTracker-2010/Tests/with_row_number_crash.Bug-2631.stable.out
sql/src/test/Dependencies/Tests/Dependencies.stable.out
Branch: Oct2010
Log Message:
many fixes in handling (NOT) IN.
Fixes in handling WITH
approved output after these changes
diffs (truncated from 491 to 300 lines):
diff -r ca2a4727d1a3 -r 3d34c0219ae0 sql/src/backends/monet5/sql.mx
--- a/sql/src/backends/monet5/sql.mx Wed Sep 15 18:29:10 2010 +0200
+++ b/sql/src/backends/monet5/sql.mx Thu Sep 16 00:37:37 2010 +0200
@@ -1637,6 +1637,18 @@
return sql_message("ALTER TABLE: insufficient privileges for
user '%s' in schema '%s'", stack_get_string(sql, "current_user"), s->base.name);
}
+ /* First check if all the changes are allowed */
+ if (t->idxs.set) {
+ /* only one pkey */
+ if (nt->pkey) {
+ for (n = t->idxs.nelm; n; n = n->next) {
+ sql_idx *i = n->data;
+ if (i->key->type == pkey)
+ return sql_message("CONSTRAINT PRIMARY
KEY: a table can have only one PRIMARY KEY\n");
+ }
+ }
+ }
+
if (t->readonly != nt->readonly)
mvc_readonly( sql, nt, t->readonly);
diff -r ca2a4727d1a3 -r 3d34c0219ae0
sql/src/benchmarks/tpch/Tests/01-22.stable.out
--- a/sql/src/benchmarks/tpch/Tests/01-22.stable.out Wed Sep 15 18:29:10
2010 +0200
+++ b/sql/src/benchmarks/tpch/Tests/01-22.stable.out Thu Sep 16 00:37:37
2010 +0200
@@ -859,11 +859,41 @@
% 7, 1 # length
[ "joinidx", 0 ]
-# 11:48:06 >
-# 11:48:06 > Mtimeout -timeout 60 MapiClient -lsql -umonetdb -Pmonetdb
--host=localhost --port=35781
-# 11:48:06 >
+# 00:16:03 >
+# 00:16:03 > Mtimeout -timeout 60 mclient -lsql -ftest -i -e --host=alf
--port=39190 <
/net/alf.ins.cwi.nl/export/scratch1/niels/rc/MonetDB/sql/src/benchmarks/tpch/16.sql
+# 00:16:03 >
-% .part, .part, .part, .partsupp # table_name
+#select
+# p_brand,
+# p_type,
+# p_size,
+# count(distinct ps_suppkey) as supplier_cnt
+#from
+# partsupp,
+# part
+#where
+# p_partkey = ps_partkey
+# and p_brand <> 'Brand#45'
+# and p_type not like 'MEDIUM POLISHED%'
+# and p_size in (49, 14, 23, 45, 19, 3, 36, 9)
+# and ps_suppkey not in (
+# select
+# s_suppkey
+# from
+# supplier
+# where
+# s_comment like '%Customer%Complaints%'
+# )
+#group by
+# p_brand,
+# p_type,
+# p_size
+#order by
+# supplier_cnt desc,
+# p_brand,
+# p_type,
+# p_size;
+% sys.part, sys.part, sys.part, sys.partsupp # table_name
% p_brand, p_type, p_size, supplier_cnt # name
% varchar, varchar, int, wrd # type
% 8, 25, 2, 1 # length
diff -r ca2a4727d1a3 -r 3d34c0219ae0 sql/src/benchmarks/tpch/Tests/16.stable.out
--- a/sql/src/benchmarks/tpch/Tests/16.stable.out Wed Sep 15 18:29:10
2010 +0200
+++ b/sql/src/benchmarks/tpch/Tests/16.stable.out Thu Sep 16 00:37:37
2010 +0200
@@ -24,7 +24,37 @@
# 12:34:53 > Mtimeout -timeout 60 MapiClient -lsql -u monetdb -P monetdb
--host=localhost --port=45579 < 16.sql
# 12:34:53 >
-% .part, .part, .part, .partsupp # table_name
+#select
+# p_brand,
+# p_type,
+# p_size,
+# count(distinct ps_suppkey) as supplier_cnt
+#from
+# partsupp,
+# part
+#where
+# p_partkey = ps_partkey
+# and p_brand <> 'Brand#45'
+# and p_type not like 'MEDIUM POLISHED%'
+# and p_size in (49, 14, 23, 45, 19, 3, 36, 9)
+# and ps_suppkey not in (
+# select
+# s_suppkey
+# from
+# supplier
+# where
+# s_comment like '%Customer%Complaints%'
+# )
+#group by
+# p_brand,
+# p_type,
+# p_size
+#order by
+# supplier_cnt desc,
+# p_brand,
+# p_type,
+# p_size;
+% sys.part, sys.part, sys.part, sys.partsupp # table_name
% p_brand, p_type, p_size, supplier_cnt # name
% varchar, varchar, int, wrd # type
% 8, 25, 2, 1 # length
diff -r ca2a4727d1a3 -r 3d34c0219ae0 sql/src/server/rel_optimizer.mx
--- a/sql/src/server/rel_optimizer.mx Wed Sep 15 18:29:10 2010 +0200
+++ b/sql/src/server/rel_optimizer.mx Thu Sep 16 00:37:37 2010 +0200
@@ -2969,7 +2969,7 @@
}
}
/* for count/rank we need atleast one column */
- if (!nr && (is_project(subrel->op) || is_base(subrel->op))) {
+ if (!nr && (is_project(subrel->op) || is_base(subrel->op)) &&
subrel->exps->h) {
sql_exp *e = subrel->exps->h->data;
e->used = 1;
}
diff -r ca2a4727d1a3 -r 3d34c0219ae0 sql/src/server/rel_schema.mx
--- a/sql/src/server/rel_schema.mx Wed Sep 15 18:29:10 2010 +0200
+++ b/sql/src/server/rel_schema.mx Thu Sep 16 00:37:37 2010 +0200
@@ -263,13 +263,6 @@
key_type kt = (s->token == SQL_UNIQUE) ? ukey : pkey;
sql_key *k;
-/*
- if (isTempTable(t)) {
- (void) sql_error(sql, 02, "CONSTRAINT: constraints on
temporary tables are not supported\n");
- return res;
- }
-*/
-
if (kt == pkey && t->pkey) {
(void) sql_error(sql, 02, "CONSTRAINT PRIMARY KEY: a
table can have only one PRIMARY KEY\n");
return res;
diff -r ca2a4727d1a3 -r 3d34c0219ae0 sql/src/server/rel_select.mx
--- a/sql/src/server/rel_select.mx Wed Sep 15 18:29:10 2010 +0200
+++ b/sql/src/server/rel_select.mx Thu Sep 16 00:37:37 2010 +0200
@@ -172,6 +172,8 @@
static void
rel_setsubquery(sql_rel*r)
{
+ if (rel_is_ref(r))
+ return;
if (r->l && !is_base(r->op))
rel_setsubquery(r->l);
if (r->r && is_join(r->op))
@@ -2616,7 +2618,7 @@
sql_exp *l = rel_value_exp(sql, &left, lo, f, ek), *e, *r =
NULL;
list *vals = NULL;
int correlated = 0, vals_only = 1;
- int l_is_value = 1;
+ int l_is_value = 1, r_is_rel = 0;
if (!l && sql->session->status != -ERR_AMBIGUOUS) {
l_is_value = 0;
@@ -2658,6 +2660,8 @@
sql_rel *rl;
r = rel_value_exp(sql, &z, sval, f, ek);
+ if (z)
+ r_is_rel = 1;
if (!r && sql->session->status !=
-ERR_AMBIGUOUS) {
/* reset error */
sql->session->status = 0;
@@ -2750,7 +2754,7 @@
}
e = exp_compare( l, r, cmp_equal );
rel_join_add_exp(rel, e);
- if (correlated || l_is_value) {
+ if (correlated || l_is_value || r_is_rel) {
rel->op = (sc->token == SQL_IN)?op_semi:op_anti;
} else if (sc->token == SQL_NOT_IN) {
rel->op = op_left;
diff -r ca2a4727d1a3 -r 3d34c0219ae0 sql/src/server/rel_semantic.mx
--- a/sql/src/server/rel_semantic.mx Wed Sep 15 18:29:10 2010 +0200
+++ b/sql/src/server/rel_semantic.mx Thu Sep 16 00:37:37 2010 +0200
@@ -256,7 +256,7 @@
dnode *dn = sym->data.lval->h;
dnode *cn = sym->data.lval->h->next;
char *name = qname_table(dn->data.lval);
- sql_rel *rel, *nrel;
+ sql_rel *nrel;
list *exps = NULL;
if (frame_find_var(sql, name)) {
@@ -272,10 +272,8 @@
append(exps, exp_column(name, cname,
NULL, CARD_MULTI, 0 /* null? */, 0));
}
}
- rel = rel_recursive_func(exps);
- stack_push_rel_view(sql, name, rel);
-
nrel = rel_semantic(sql, sym);
+ stack_push_rel_view(sql, name, nrel);
if (!nrel) {
stack_pop_frame(sql);
return NULL;
@@ -287,9 +285,6 @@
for (; ne; ne = ne->next)
exp_setname( ne->data, name, NULL );
}
- if (!rel_is_ref(rel))
- stack_set_rel_view(sql, name, nrel);
- rel_destroy(nrel);
}
rel = rel_semantic(sql, select);
stack_pop_frame(sql);
@@ -297,7 +292,6 @@
}
case SQL_MULSTMT: {
- //assert(0); /* handled before rel_semantic */
dnode *d;
sql_rel *r = NULL;
diff -r ca2a4727d1a3 -r 3d34c0219ae0
sql/src/test/BugTracker-2010/Tests/copy-into-too-long-string.Bug-2358.sql
--- a/sql/src/test/BugTracker-2010/Tests/copy-into-too-long-string.Bug-2358.sql
Wed Sep 15 18:29:10 2010 +0200
+++ b/sql/src/test/BugTracker-2010/Tests/copy-into-too-long-string.Bug-2358.sql
Thu Sep 16 00:37:37 2010 +0200
@@ -3,3 +3,6 @@
COPY 1 RECORDS INTO t FROM STDIN USING DELIMITERS '|','
','"' NULL AS '';
"abcd"
+
+
+drop table t;
diff -r ca2a4727d1a3 -r 3d34c0219ae0
sql/src/test/BugTracker-2010/Tests/duplicate-key.Bug-2667.stable.err
--- a/sql/src/test/BugTracker-2010/Tests/duplicate-key.Bug-2667.stable.err
Wed Sep 15 18:29:10 2010 +0200
+++ b/sql/src/test/BugTracker-2010/Tests/duplicate-key.Bug-2667.stable.err
Thu Sep 16 00:37:37 2010 +0200
@@ -72,12 +72,12 @@
# 12:43:13 > mclient -lsql -ftest -i -e --host=ottar --port=34908
# 12:43:13 >
-MAPI = mone...@ottar:32832
+MAPI = mone...@alf:34990
QUERY = ALTER TABLE mulpk ADD CONSTRAINT pk2 PRIMARY KEY (id);
-ERROR = !CONSTRAINT PRIMARY KEY: a table can have only one PRIMARY KEY
-MAPI = mone...@ottar:32832
+ERROR = !SQLException:sql.catalog:CONSTRAINT PRIMARY KEY: a table can have
only one PRIMARY KEY
+MAPI = mone...@alf:34990
QUERY = ALTER TABLE mulpk ADD CONSTRAINT pk3 PRIMARY KEY (id);
-ERROR = !CONSTRAINT PRIMARY KEY: a table can have only one PRIMARY KEY
+ERROR = !SQLException:sql.catalog:CONSTRAINT PRIMARY KEY: a table can have
only one PRIMARY KEY
# 12:43:13 >
# 12:43:13 > Done.
diff -r ca2a4727d1a3 -r 3d34c0219ae0
sql/src/test/BugTracker-2010/Tests/multiple-common-table-expressions.Bug-2664.stable.out
---
a/sql/src/test/BugTracker-2010/Tests/multiple-common-table-expressions.Bug-2664.stable.out
Wed Sep 15 18:29:10 2010 +0200
+++
b/sql/src/test/BugTracker-2010/Tests/multiple-common-table-expressions.Bug-2664.stable.out
Thu Sep 16 00:37:37 2010 +0200
@@ -1,1 +1,125 @@
-Output to be approved when bug is fixed.
+stdout of test 'multiple-common-table-expressions.Bug-2664` in directory
'src/test/BugTracker-2010` itself:
+
+
+# 23:46:21 >
+# 23:46:21 > mserver5
"--config=/ufs/niels/scratch/rc/Linux-x86_64/etc/monetdb5.conf" --debug=10
--set gdk_nr_threads=0 --set
"monet_mod_path=/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/bin"
--set "gdk_dbfarm=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/dbfarm"
--set mapi_open=true --set xrpc_open=true --set mapi_port=39748 --set
xrpc_port=42172 --set monet_prompt= --set mal_listing=2 --trace
"--dbname=mTests_src_test_BugTracker-2010" --set mal_listing=0 ; echo ; echo
Over..
+# 23:46:21 >
+
+# MonetDB server v5.22.0, based on kernel v1.40.0
+# Not released
+# Serving database 'mTests_src_test_BugTracker-2010', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 7.753 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2010 MonetDB B.V., all rights reserved
+# Visit http://monetdb.cwi.nl/ for further information
+#WARNING: LoaderException:loadLibrary:Loading error 'libmseed.so.2: cannot
open shared object file: No such file or directory' from within file 'vault'
+# Listening for connection requests on mapi:monetdb://alf.ins.cwi.nl:39748/
+# MonetDB/SQL module v2.40.0 loaded
+
+Ready.
+
+Over..
+
+# 23:46:21 >
+# 23:46:21 > mclient -lsql -ftest -i -e --host=alf --port=39748
+# 23:46:21 >
+
+#with t(id) as (select id from tables)
+#select id from tables
+# where id in (select id from t)
+# and id in (select id from t);
+% .tables # table_name
+% id # name
+% int # type
+% 4 # length
+[ 2001 ]
+[ 2006 ]
+[ 2015 ]
+[ 2024 ]
+[ 2032 ]
+[ 2042 ]
+[ 2046 ]
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list