Changeset: ecafd37b7cb4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ecafd37b7cb4 Added Files: sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.err sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.err sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.out Modified Files: sql/server/rel_optimizer.c sql/test/BugTracker-2017/Tests/All sql/test/BugTracker-2017/Tests/distinct_minus_count_distinct.Bug-6296.stable.out sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.sql Branch: Jul2017 Log Message:
fixed bugs 6496 and 6493, don't over reduce the number of group by expressions. diffs (276 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 @@ -5063,6 +5063,9 @@ rel_reduce_groupby_exps(int *changes, mv if (!exp_is_atom(e)) append(ngbe, e); + /* we need at least one gbe */ + else if (!n->next && list_empty(ngbe)) + append(ngbe, e); else append(dgbe, e); } @@ -5088,8 +5091,8 @@ rel_reduce_groupby_exps(int *changes, mv append(nexps, e); } rel->exps = nexps; - } - (*changes)++; + (*changes)++; + } } } return rel; 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 @@ -105,5 +105,5 @@ select-in-returns-null.Bug-6491 sqlitelogictest-min-distinct-empty-table.Bug-6493 sqlitelogictest-algebra-operators.Bug-6494 sqlitelogictest-hidden-alias.Bug-6495 -sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.sql +sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496 sqlitelogictest-not-between.Bug-6497 diff --git a/sql/test/BugTracker-2017/Tests/distinct_minus_count_distinct.Bug-6296.stable.out b/sql/test/BugTracker-2017/Tests/distinct_minus_count_distinct.Bug-6296.stable.out --- a/sql/test/BugTracker-2017/Tests/distinct_minus_count_distinct.Bug-6296.stable.out +++ b/sql/test/BugTracker-2017/Tests/distinct_minus_count_distinct.Bug-6296.stable.out @@ -78,8 +78,8 @@ Ready. % .L4 # table_name % col1 # name % bigint # type -% 2 # length -[ -1 ] +% 1 # length +[ 0 ] #DROP TABLE tab2; #DROP TABLE tab0; diff --git a/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.sql b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.sql --- a/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.sql +++ b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.sql @@ -9,6 +9,7 @@ INSERT INTO tab0 VALUES(6,904,193.16,'eo INSERT INTO tab0 VALUES(7,606,650.64,'ovmce',417,962.43,'dvkbh'); INSERT INTO tab0 VALUES(8,535,18.11,'ijika',630,489.63,'hpnyu'); INSERT INTO tab0 VALUES(9,501,776.40,'cvygg',725,75.5,'etlyv'); +SELECT * FROM tab0 AS cor0 WHERE NOT ( - col0 ) BETWEEN - + col4 AND NULL; --should be -5 SELECT + - COUNT ( * ) FROM tab0 AS cor0 WHERE NOT ( - col0 ) BETWEEN - + col4 AND NULL; --should be -5 DROP TABLE tab0; @@ -16,5 +17,6 @@ CREATE TABLE tab1(col0 INTEGER, col1 INT INSERT INTO tab1 VALUES(51,14,96); INSERT INTO tab1 VALUES(85,5,59); INSERT INTO tab1 VALUES(91,47,68); +SELECT * FROM tab1 AS cor0 WHERE col2 + 5 > NULL; --should be 0 SELECT ALL + COUNT ( DISTINCT 64 ) FROM tab1 AS cor0 WHERE col2 + 5 > NULL; --should be 0 DROP TABLE tab1; diff --git a/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.err b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.err @@ -0,0 +1,34 @@ +stderr of test 'sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496` in directory 'sql/test/BugTracker-2017` itself: + + +# 11:02:05 > +# 11:02:05 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33095" "--set" "mapi_usock=/var/tmp/mtest-5852/.s.monetdb.33095" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017" +# 11:02:05 > + +# 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 = 33095 +# cmdline opt mapi_usock = /var/tmp/mtest-5852/.s.monetdb.33095 +# 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 = 553648138 + +# 11:02:06 > +# 11:02:06 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-5852" "--port=33095" +# 11:02:06 > + + +# 11:02:06 > +# 11:02:06 > "Done." +# 11:02:06 > + diff --git a/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out @@ -0,0 +1,83 @@ +stdout of test 'sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496` in directory 'sql/test/BugTracker-2017` itself: + + +# 11:02:05 > +# 11:02:05 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33095" "--set" "mapi_usock=/var/tmp/mtest-5852/.s.monetdb.33095" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017" +# 11:02:05 > + +# 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:33095/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-5852/.s.monetdb.33095 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded + +Ready. + +# 11:02:06 > +# 11:02:06 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-5852" "--port=33095" +# 11:02:06 > + +#CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2 TEXT, col3 INTEGER, col4 FLOAT, col5 TEXT); +#INSERT INTO tab0 VALUES(0,698,169.42,'apdbu',431,316.15,'sqvis'); +[ 1 ] +#INSERT INTO tab0 VALUES(1,538,676.36,'fuqeu',514,685.97,'bgwrq'); +[ 1 ] +#INSERT INTO tab0 VALUES(2,90,205.26,'yrrzx',123,836.88,'kpuhc'); +[ 1 ] +#INSERT INTO tab0 VALUES(3,620,864.8,'myrdv',877,820.98,'oxkuv'); +[ 1 ] +#INSERT INTO tab0 VALUES(4,754,677.3,'iofrg',67,665.49,'bzqba'); +[ 1 ] +#INSERT INTO tab0 VALUES(5,107,710.19,'lhfro',286,504.28,'kwwsg'); +[ 1 ] +#INSERT INTO tab0 VALUES(6,904,193.16,'eozui',48,698.55,'ejyzs'); +[ 1 ] +#INSERT INTO tab0 VALUES(7,606,650.64,'ovmce',417,962.43,'dvkbh'); +[ 1 ] +#INSERT INTO tab0 VALUES(8,535,18.11,'ijika',630,489.63,'hpnyu'); +[ 1 ] +#INSERT INTO tab0 VALUES(9,501,776.40,'cvygg',725,75.5,'etlyv'); +[ 1 ] +#SELECT * FROM tab0 AS cor0 WHERE NOT ( - col0 ) BETWEEN - + col4 AND NULL; --should be -5 +% 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 +#SELECT + - COUNT ( * ) FROM tab0 AS cor0 WHERE NOT ( - col0 ) BETWEEN - + col4 AND NULL; --should be -5 +% sys.L4 # table_name +% L4 # name +% bigint # type +% 1 # length +[ 0 ] +#DROP TABLE tab0; +#CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER); +#INSERT INTO tab1 VALUES(51,14,96); +[ 1 ] +#INSERT INTO tab1 VALUES(85,5,59); +[ 1 ] +#INSERT INTO tab1 VALUES(91,47,68); +[ 1 ] +#SELECT * FROM tab1 AS cor0 WHERE col2 + 5 > NULL; --should be 0 +% sys.cor0, sys.cor0, sys.cor0 # table_name +% col0, col1, col2 # name +% int, int, int # type +% 1, 1, 1 # length +#SELECT ALL + COUNT ( DISTINCT 64 ) FROM tab1 AS cor0 WHERE col2 + 5 > NULL; --should be 0 +% .L4 # table_name +% L3 # name +% bigint # type +% 1 # length +[ 0 ] +#DROP TABLE tab1; + +# 11:02:06 > +# 11:02:06 > "Done." +# 11:02:06 > + diff --git a/sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.err b/sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.err @@ -0,0 +1,34 @@ +stderr of test 'sqlitelogictest-min-distinct-empty-table.Bug-6493` in directory 'sql/test/BugTracker-2017` itself: + + +# 11:02:03 > +# 11:02:03 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33095" "--set" "mapi_usock=/var/tmp/mtest-5852/.s.monetdb.33095" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017" +# 11:02:03 > + +# 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 = 33095 +# cmdline opt mapi_usock = /var/tmp/mtest-5852/.s.monetdb.33095 +# 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 = 553648138 + +# 11:02:04 > +# 11:02:04 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-5852" "--port=33095" +# 11:02:04 > + + +# 11:02:04 > +# 11:02:04 > "Done." +# 11:02:04 > + diff --git a/sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.out b/sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2017/Tests/sqlitelogictest-min-distinct-empty-table.Bug-6493.stable.out @@ -0,0 +1,39 @@ +stdout of test 'sqlitelogictest-min-distinct-empty-table.Bug-6493` in directory 'sql/test/BugTracker-2017` itself: + + +# 11:02:03 > +# 11:02:03 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33095" "--set" "mapi_usock=/var/tmp/mtest-5852/.s.monetdb.33095" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017" +# 11:02:03 > + +# 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:33095/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-5852/.s.monetdb.33095 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded + +Ready. + +# 11:02:04 > +# 11:02:04 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-5852" "--port=33095" +# 11:02:04 > + +#CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2 TEXT, col3 INTEGER, col4 FLOAT, col5 TEXT); +#SELECT - MIN ( DISTINCT + 79 ) FROM tab0 AS cor0 WHERE NOT + col4 IS NOT NULL; +% .L4 # table_name +% L4 # name +% tinyint # type +% 1 # length +[ NULL ] +#DROP TABLE tab0; + +# 11:02:04 > +# 11:02:04 > "Done." +# 11:02:04 > + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list