Changeset: 64ed1c560295 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=64ed1c560295
Modified Files:
        sql/server/rel_optimizer.c
        sql/server/rel_select.c
        
sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.err
        
sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.out
        sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.err
        sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.out
        sql/test/BugTracker-2012/Tests/set_operation.Bug-3059.stable.err
        sql/test/BugTracker-2012/Tests/set_operation.Bug-3059.stable.out
Branch: Apr2012
Log Message:

fixed bugs 3047 and 3059
3047 failed because of a bug in the handling of "IN" with correlation and
values on the left side.
3059 failed because the to many column expressions were removed in case of
set operators

Added out put for bug 3048, which runs fine without the m5 joinpath optimizer


diffs (truncated from 449 to 300 lines):

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
@@ -1752,7 +1752,8 @@ rel_push_topn_down(int *changes, mvc *sq
 /* push an expression through a projection. 
  * The result should again used in a projection.
  */
-static sql_exp * exp_push_down_prj(mvc *sql, sql_exp *e, sql_rel *f, sql_rel 
*t);
+static sql_exp *
+exp_push_down_prj(mvc *sql, sql_exp *e, sql_rel *f, sql_rel *t);
 
 static list *
 exps_push_down_prj(mvc *sql, list *exps, sql_rel *f, sql_rel *t)
@@ -4290,12 +4291,15 @@ rel_mark_used(mvc *sql, sql_rel *rel, in
                        rel_mark_used(sql, rel->l, 0);
                        rel_mark_used(sql, rel->r, 0);
                } else if (proj && !need_distinct(rel)) {
-                       positional_exps_mark_used(rel, rel->l);
+                       sql_rel *l = rel->l;
+
+                       positional_exps_mark_used(rel, l);
+                       rel_mark_used(sql, rel->l, 1);
+                       /* based on child check set expression list */
+                       if (is_project(l->op) && need_distinct(l))
+                               positional_exps_mark_used(l, rel);
                        positional_exps_mark_used(rel, rel->r);
-                       rel_mark_used(sql, rel->l, 1);
                        rel_mark_used(sql, rel->r, 1);
-                       /* based on child check union expression list */
-                       positional_exps_mark_used(rel->l, rel);
                }
                break;
 
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
@@ -2986,7 +2986,10 @@ rel_logical_exp(mvc *sql, sql_rel *rel, 
                                        sql->errstr[0] = 0;
 
                                        /* TODO remove null checking (not 
needed in correlated case because of the semi/anti join) ! */
-                                       rel = left = rel_dup(left);
+                                       if (l_is_value) 
+                                               rel = rel_dup(outer);
+                                       else
+                                               rel = left = rel_dup(left);
                                        r = rel_value_exp(sql, &rel, sval, f, 
ek);
                                        if (r && !is_project(rel->op)) {
                                                rel = rel_project(sql->sa, rel, 
NULL);
diff --git 
a/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.err
 
b/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.err
--- 
a/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.err
+++ 
b/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.err
@@ -1,1 +1,37 @@
-Output to be provided.
+stderr of test 'multiple-arithmetic-operations.Bug-3048` in directory 
'test/BugTracker-2012` itself:
+
+
+# 14:56:17 >  
+# 14:56:17 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=36593" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2012" 
"--set" "mal_listing=0"
+# 14:56:17 >  
+
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# 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  gdk_dbfarm = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 36593
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_test_BugTracker-2012
+# cmdline opt  mal_listing = 0
+
+# 14:56:17 >  
+# 14:56:17 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=niels" 
"--port=36593"
+# 14:56:17 >  
+
+
+# 14:56:17 >  
+# 14:56:17 >  "Done."
+# 14:56:17 >  
+
diff --git 
a/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.out
 
b/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.out
--- 
a/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.out
+++ 
b/sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.out
@@ -1,1 +1,141 @@
-Output to be provided.
+stdout of test 'multiple-arithmetic-operations.Bug-3048` in directory 
'test/BugTracker-2012` itself:
+
+
+# 14:56:17 >  
+# 14:56:17 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=36593" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2012" 
"--set" "mal_listing=0"
+# 14:56:17 >  
+
+# MonetDB 5 server v11.9.2
+# This is an unreleased version
+# Serving database 'mTests_test_BugTracker-2012', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 3.778 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2012 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://niels.nesco.mine.nu:36593/
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 14:56:17 >  
+# 14:56:17 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=niels" 
"--port=36593"
+# 14:56:17 >  
+
+#START TRANSACTION;
+#CREATE TABLE "productfeature" (
+#  "nr" int primary key,
+#  "label" varchar(100) default NULL,
+#  "comment" varchar(2000) default NULL,
+#  "publisher" int,
+#  "publishDate" date
+#);
+#CREATE TABLE "producttype" (
+#  "nr" int primary key,
+#  "label" varchar(100) default NULL,
+#  "comment" varchar(2000) default NULL,
+#  "parent" int,
+#  "publisher" int,
+#  "publishDate" date
+#);
+#CREATE TABLE "producer" (
+#  "nr" int primary key,
+#  "label" varchar(100) default NULL,
+#  "comment" varchar(2000) default NULL,
+#  "homepage" varchar(100) default NULL,
+#  "country" char(2) ,
+#  "publisher" int,
+#  "publishDate" date
+#);
+#CREATE TABLE "product" (
+#  "nr" int primary key,
+#  "label" varchar(100) default NULL,
+#  "comment" varchar(2000) default NULL,
+#  "producer" int default NULL,
+#  "propertyNum1" int default NULL,
+#  "propertyNum2" int default NULL,
+#  "propertyNum3" int default NULL,
+#  "propertyNum4" int default NULL,
+#  "propertyNum5" int default NULL,
+#  "propertyNum6" int default NULL,
+#  "propertyTex1" varchar(250) default NULL,
+#  "propertyTex2" varchar(250) default NULL,
+#  "propertyTex3" varchar(250) default NULL,
+#  "propertyTex4" varchar(250) default NULL,
+#CREATE TABLE "producttypeproduct" (
+#  "product" int not null,
+#  "productType" int not null,
+#  PRIMARY KEY ("product", "productType")
+#);
+#CREATE TABLE "productfeatureproduct" (
+#  "product" int not null,
+#  "productFeature" int not null,
+#  PRIMARY KEY ("product", "productFeature")
+#);
+#CREATE TABLE "vendor" (
+#  "nr" int primary key,
+#  "label" varchar(100) default NULL,
+#  "comment" varchar(2000) default NULL,
+#  "homepage" varchar(100) default NULL,
+#  "country" char(2) ,
+#  "publisher" int,
+#  "publishDate" date
+#);
+#CREATE TABLE "offer" (
+#  "nr" int primary key,
+#  "product" int,
+#  "producer" int,
+#  "vendor" int,
+#  "price" double default null,
+#  "validFrom" date default null,
+#  "validTo" date default null,
+#  "deliveryDays" int default null,
+#  "offerWebpage" varchar(100) ,
+#  "publisher" int,
+#  "publishDate" date
+#);
+#CREATE TABLE "person" (
+#  "nr" int primary key,
+#  "name" varchar(30) default NULL,
+#  "mbox_sha1sum" char(40) ,
+#  "country" char(2) ,
+#  "publisher" int,
+#  "publishDate" date
+#);
+#CREATE TABLE "review" (
+#  "nr" int primary key,
+#  "product" int,
+#  "producer" int,
+#  "person" int,
+#  "reviewDate" date default NULL,
+#  "title" varchar(200) default NULL,
+#  "text" text ,
+#  "language" char(2) ,
+#  "rating1" int default NULL,
+#  "rating2" int default NULL,
+#  "rating3" int default NULL,
+#  "rating4" int default NULL,
+#  "publisher" int,
+#  "publishDate" date
+#);
+#SELECT distinct p.nr, p.label
+#  FROM product p, product po,
+#   (Select distinct pfp1.product FROM productfeatureproduct pfp1, 
+#   (SELECT "productFeature" FROM productfeatureproduct WHERE product=2) pfp2 
+#      WHERE pfp2."productFeature"=pfp1."productFeature") pfp
+#    WHERE p.nr=pfp.product AND po.nr=2 AND p.nr <> po.nr
+#    AND p."propertyNum1" < (po."propertyNum1"+120) AND p."propertyNum1" >
+#(po."propertyNum1"-120)
+#    AND p."propertyNum2" < (po."propertyNum2"+170) AND p."propertyNum2" >
+#(po."propertyNum2"-170);
+% sys.p,       sys.p # table_name
+% nr,  label # name
+% int, varchar # type
+% 1,   0 # length
+#ROLLBACK;
+
+# 14:56:17 >  
+# 14:56:17 >  "Done."
+# 14:56:17 >  
+
diff --git 
a/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.err 
b/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.err
--- a/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.err
+++ b/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.err
@@ -1,1 +1,37 @@
-Output to be provided.
+stderr of test 'parent-table-alias.Bug-3047` in directory 
'test/BugTracker-2012` itself:
+
+
+# 14:45:55 >  
+# 14:45:55 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=39835" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2012" 
"--set" "mal_listing=0"
+# 14:45:55 >  
+
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# 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  gdk_dbfarm = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 39835
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_test_BugTracker-2012
+# cmdline opt  mal_listing = 0
+
+# 14:45:55 >  
+# 14:45:55 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=niels" 
"--port=39835"
+# 14:45:55 >  
+
+
+# 14:45:55 >  
+# 14:45:55 >  "Done."
+# 14:45:55 >  
+
diff --git 
a/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.out 
b/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.out
--- a/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.out
+++ b/sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.out
@@ -1,1 +1,139 @@
-Output to be provided.
+stdout of test 'parent-table-alias.Bug-3047` in directory 
'test/BugTracker-2012` itself:
+
+
+# 14:45:55 >  
+# 14:45:55 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=39835" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2012" 
"--set" "mal_listing=0"
+# 14:45:55 >  
+
+# MonetDB 5 server v11.9.2
+# This is an unreleased version
+# Serving database 'mTests_test_BugTracker-2012', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 3.778 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2012 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://niels.nesco.mine.nu:39835/
+# MonetDB/GIS module loaded
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to