Changeset: 8b1a2f29421d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8b1a2f29421d Added Files: README.rst Removed Files: README documentation/old/README.rst Modified Files: sql/server/rel_optimizer.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out sql/test/mergetables/Tests/sqlsmith-exists2.sql sql/test/mergetables/Tests/sqlsmith-exists2.stable.out sql/test/miscellaneous/Tests/simple_plans.stable.out sql/test/miscellaneous/Tests/simple_plans.stable.out.single sql/test/xquery/Tests/q01.stable.out Branch: default Log Message:
Merged with oscar diffs (truncated from 383 to 300 lines): diff --git a/README b/README deleted file mode 100644 --- a/README +++ /dev/null @@ -1,22 +0,0 @@ -The MonetDB Database System - -The MonetDB database is developed by the CWI database research group -(see https://www.monetdb.org/). - -Via the MonetDB project we have brought the MonetDB system in open source, -where it is accessible at https://www.monetdb.org/Downloads/ - -The MonetDB database system is a high-performance database kernel for -query-intensive applications. The MonetDB source can be found at our mercurial server (https://dev.monetdb.org/hg/MonetDB/). There is also a github clone (https://github.com/MonetDB/MonetDB) that is updated once a day. - -If you got a source distribution, please compile and install MonetDB first, -following the instructions in the "documentation" directory. - - -Copyright Notice - -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at http://mozilla.org/MPL/2.0/. - -Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. diff --git a/documentation/old/README.rst b/README.rst rename from documentation/old/README.rst rename to README.rst 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 @@ -1449,6 +1449,9 @@ exp_push_single_func_down(visitor *v, sq } } break; case e_convert: + if ((e->l = exp_push_single_func_down(v, rel, l, r, e->l)) == NULL) + return NULL; + break; case e_aggr: case e_func: { int must = 0, mustl = 0, mustr = 0; @@ -3751,6 +3754,7 @@ rel_project_cse(visitor *v, sql_rel *rel sql_exp *ne = exp_alias(v->sql->sa, exp_relname(e1), exp_name(e1), exp_relname(e2), exp_name(e2), exp_subtype(e2), e2->card, has_nil(e2), is_intern(e1)); ne = exp_propagate(v->sql->sa, ne, e1); + exp_setname(v->sql->sa, ne, exp_relname(e1), exp_name(e1)); e1 = ne; break; } diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql b/sql/test/SQLancer/Tests/sqlancer03.sql --- a/sql/test/SQLancer/Tests/sqlancer03.sql +++ b/sql/test/SQLancer/Tests/sqlancer03.sql @@ -66,20 +66,20 @@ select "insert"('屁{珙', 1, 1, '1'), "insert"('屁{珙', 1, 1, '抔'), "insert"('屁抔珙', 1, 1, 'ಜ'), "insert"('a', 0, 1, 'ಜ'), "insert"('a', 0, 0, 'ಜ'); select "insert"('屁{珙', 1, 1, '1'), "insert"('屁{珙', 1, 1, '抔'), "insert"('屁抔珙', 1, 1, 'ಜ') from t0; ROLLBACK; -CREATE TABLE t0(c0 boolean, c1 boolean, c2 serial, UNIQUE(c0, c1)); -- Bug 6920 -INSERT INTO t0(c1) VALUES((0.5968066098520423) NOT BETWEEN SYMMETRIC (CAST(length(upper(r'z')) AS INT)) AND (1347145665)), (FALSE); +CREATE TABLE t0(c0 boolean, c1 boolean, c2 int, UNIQUE(c0, c1)); -- Bug 6920 +INSERT INTO t0(c1) VALUES((0.5) NOT BETWEEN SYMMETRIC (CAST(length(upper(r'z')) AS INT)) AND (2)), (FALSE); INSERT INTO t0(c0) VALUES(TRUE); INSERT INTO t0(c1) VALUES(FALSE), (TRUE); -INSERT INTO t0(c2, c0, c1) VALUES(1347145665, (ltrim(lower(r'K'), ((upper(r'296348087'))||(- (1582370739))))) IS NOT NULL, (((lower(r'ö -eg#K,纗HSJw!{cOw⇒l/l!B*H'))||(((CAST(0.12411368110083143 AS INT))+(-1795901173))))) IN (lower(CAST(TRUE AS STRING)))), (-1795901173, NULL, (0.9575114678279173) NOT IN (2.96348087E8, 0.5010777753365665)), (1922411524, TRUE, (0.5020325273627405) NOT IN (-1388966352, 1163825182)); +INSERT INTO t0(c2, c0, c1) VALUES(2, (ltrim(lower(r'K'), ((upper(r'4'))||(- (7))))) IS NOT NULL, (((lower(r'ö +eg#K,纗HSJw!{cOw⇒l/l!B*H'))||(((CAST(0.1 AS INT))+(-5))))) IN (lower(CAST(TRUE AS STRING)))), (-9, NULL, (0.3) NOT IN (2.96348087E8, 0.3)), (4, TRUE, (0.5) NOT IN (-3, 4)); INSERT INTO t0(c1) VALUES(TRUE); INSERT INTO t0(c1, c2) VALUES(FALSE, 623585248); -INSERT INTO t0(c0) VALUES(NOT (NOT ((((-1388966352)*(-984145454))) NOT IN (0.7356286)))), (FALSE); +INSERT INTO t0(c0) VALUES(NOT (NOT ((((-1)*(-9))) NOT IN (0.7)))), (FALSE); INSERT INTO t0(c0) VALUES(TRUE); -INSERT INTO t0(c2) VALUES(-1235619315); +INSERT INTO t0(c2) VALUES(-1); DELETE FROM t0 WHERE (t0.c0) = FALSE; -INSERT INTO t0(c1, c0, c2) VALUES(TRUE, ((+ (- (1580722914)))>(charindex(CAST(0.347536126443453330381316845887340605258941650390625 AS STRING), ((CAST(TRUE AS STRING(771)))||(0.2182260714120349831546263885684311389923095703125)), length(r'd')))), -1819817735); -UPDATE t0 SET c2 = DEFAULT WHERE ((((t0.c1)OR(CAST(t0.c2 AS BOOLEAN))))OR((CAST(0.6873694879073857 AS DECIMAL)) NOT IN (0.10021624439224552371996423971722833812236785888671875))); +INSERT INTO t0(c1, c0, c2) VALUES(TRUE, ((+ (- (1)))>(charindex(CAST(0.3 AS STRING), ((CAST(TRUE AS STRING(771)))||(0.2)), length(r'd')))), -1); +UPDATE t0 SET c2 = 1 WHERE ((((t0.c1)OR(CAST(t0.c2 AS BOOLEAN))))OR((CAST(0.6 AS DECIMAL)) NOT IN (0.1))); SELECT t0.c0 FROM t0 WHERE ((CAST(t0.c2 AS INT)) NOT BETWEEN ASYMMETRIC (abs(t0.c2)) AND (((t0.c2)/(t0.c2)))) NOT BETWEEN ASYMMETRIC (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); SELECT t0.c0 FROM t0 WHERE (t0.c2) BETWEEN (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); DROP TABLE t0; diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out b/sql/test/SQLancer/Tests/sqlancer03.stable.out --- a/sql/test/SQLancer/Tests/sqlancer03.stable.out +++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out @@ -159,20 +159,11 @@ stdout of test 'sqlancer03` in directory % c0 # name % boolean # type % 5 # length -[ NULL ] -[ NULL ] +[ true ] [ true ] -[ NULL ] -[ NULL ] [ true ] -[ NULL ] -[ true ] -[ NULL ] -[ NULL ] [ true ] [ false ] -[ true ] -[ NULL ] #SELECT t0.c0 FROM t0 WHERE (t0.c2) BETWEEN (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); % sys.t0 # table_name % c0 # name diff --git a/sql/test/mergetables/Tests/sqlsmith-exists2.sql b/sql/test/mergetables/Tests/sqlsmith-exists2.sql --- a/sql/test/mergetables/Tests/sqlsmith-exists2.sql +++ b/sql/test/mergetables/Tests/sqlsmith-exists2.sql @@ -519,4 +519,44 @@ where (case when exists ( and (subq_0.c3 is null); -- empty +WITH ss_items AS + (SELECT 1 item_id, + 1 ss_item_rev + FROM another_T, + LongTable + WHERE another_T.col1 = LongTable.col1), + cs_items AS + (SELECT 1 item_id, + 1 cs_item_rev + FROM tab0, + LongTable + WHERE tab0.col1 = LongTable.col1), + ws_items AS + (SELECT 1 item_id, + 1 ws_item_rev + FROM tbl_ProductSales, + LongTable + WHERE tbl_ProductSales.col1 = LongTable.col1) +SELECT ss_items.item_id, + ss_item_rev, + ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev, + cs_item_rev, + cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 cs_dev, + ws_item_rev, + ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ws_dev, + (ss_item_rev+cs_item_rev+ws_item_rev)/3 average +FROM ss_items, + cs_items, + ws_items +WHERE ss_items.item_id=cs_items.item_id + AND ss_items.item_id=ws_items.item_id +ORDER BY ss_items.item_id, + ss_item_rev +LIMIT 100; + +create table myitem (i_current_price decimal(7,2)); +SELECT 1 FROM myitem WHERE i_current_price BETWEEN 64 AND 64 + 10 AND i_current_price BETWEEN 64 + 1 AND 64 + 15; + +SELECT 1 FROM tab0 WHERE col0 BETWEEN 64 AND 64 + 10 AND col0 BETWEEN 64 + 1 AND 64 + 15; + ROLLBACK; diff --git a/sql/test/mergetables/Tests/sqlsmith-exists2.stable.out b/sql/test/mergetables/Tests/sqlsmith-exists2.stable.out --- a/sql/test/mergetables/Tests/sqlsmith-exists2.stable.out +++ b/sql/test/mergetables/Tests/sqlsmith-exists2.stable.out @@ -159,8 +159,8 @@ stdout of test 'sqlsmith-exists2` in dir # 1) # and (ref_4.i is not null)))) # on (ref_1.bb is null); -% .%27 # table_name -% %27 # name +% .%26 # table_name +% %26 # name % tinyint # type % 1 # length #select @@ -434,6 +434,44 @@ stdout of test 'sqlsmith-exists2` in dir % c0, c1, c2, c3, c4 # name % int, int, int, int, int # type % 1, 1, 1, 1, 1 # length +#WITH ss_items AS +# (SELECT 1 item_id, +# 1 ss_item_rev +# FROM another_T, +# LongTable +# WHERE another_T.col1 = LongTable.col1), +# cs_items AS +# (SELECT 1 item_id, +# 1 cs_item_rev +# FROM tab0, +# LongTable +# WHERE tab0.col1 = LongTable.col1), +# ws_items AS +# (SELECT 1 item_id, +# 1 ws_item_rev +# FROM tbl_ProductSales, +# LongTable +# WHERE tbl_ProductSales.col1 = LongTable.col1) +#SELECT ss_items.item_id, +# ss_item_rev, +# ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev, +% .ss_items, .ss_items, ., .cs_items, ., .ws_items, ., . # table_name +% item_id, ss_item_rev, ss_dev, cs_item_rev, cs_dev, ws_item_rev, ws_dev, average # name +% tinyint, tinyint, int, tinyint, int, tinyint, int, smallint # type +% 1, 1, 3, 1, 3, 1, 3, 1 # length +[ 1, 1, 100, 1, 100, 1, 100, 1 ] +[ 1, 1, 100, 1, 100, 1, 100, 1 ] +#create table myitem (i_current_price decimal(7,2)); +#SELECT 1 FROM myitem WHERE i_current_price BETWEEN 64 AND 64 + 10 AND i_current_price BETWEEN 64 + 1 AND 64 + 15; +% .%52 # table_name +% %52 # name +% tinyint # type +% 1 # length +#SELECT 1 FROM tab0 WHERE col0 BETWEEN 64 AND 64 + 10 AND col0 BETWEEN 64 + 1 AND 64 + 15; +% .%2 # table_name +% %2 # name +% tinyint # type +% 1 # length #ROLLBACK; # 22:12:15 > diff --git a/sql/test/miscellaneous/Tests/simple_plans.stable.out b/sql/test/miscellaneous/Tests/simple_plans.stable.out --- a/sql/test/miscellaneous/Tests/simple_plans.stable.out +++ b/sql/test/miscellaneous/Tests/simple_plans.stable.out @@ -268,61 +268,61 @@ end user.main; % clob # type % 174 # length function user.main():void; - X_1:void := querylog.define("explain select 1 from another_t t1 inner join another_t t2 on t1.col1 between t2.col1 - 1 and t2.col1 + 1;":str, "default_pipe":str, 32:int); -barrier X_169:bit := language.dataflow(); - X_46:bat[:str] := bat.pack(".%14":str); - X_47:bat[:str] := bat.pack("%14":str); - X_48:bat[:str] := bat.pack("tinyint":str); - X_49:bat[:int] := bat.pack(1:int); - X_50:bat[:int] := bat.pack(0:int); + X_1:void := querylog.define("explain select 1 from another_t t1 inner join another_t t2 on t1.col1 between t2.col1 - 1 and t2.col1 + 1;":str, "default_pipe":str, 31:int); +barrier X_164:bit := language.dataflow(); + X_45:bat[:str] := bat.pack(".%15":str); + X_46:bat[:str] := bat.pack("%15":str); + X_47:bat[:str] := bat.pack("tinyint":str); + X_48:bat[:int] := bat.pack(1:int); + X_49:bat[:int] := bat.pack(0:int); X_4:int := sql.mvc(); - C_99:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 0:int, 4:int); - X_110:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 0:int, 4:int); - X_115:bat[:int] := algebra.projection(C_99:bat[:oid], X_110:bat[:int]); + C_98:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 0:int, 4:int); + X_109:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 0:int, 4:int); + X_114:bat[:int] := algebra.projection(C_98:bat[:oid], X_109:bat[:int]); + X_118:bat[:lng] := batcalc.lng(X_114:bat[:int]); + C_12:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str); + X_14:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int); + X_15:bat[:int] := algebra.projection(C_12:bat[:oid], X_14:bat[:int]); + X_16:bat[:lng] := batcalc.lng(X_15:bat[:int]); + X_19:bat[:lng] := batcalc.-(X_16:bat[:lng], 1:lng, nil:BAT); + X_24:bat[:lng] := batcalc.+(X_16:bat[:lng], 1:lng, nil:BAT); + X_122:bat[:oid] := algebra.rangejoin(X_118:bat[:lng], X_19:bat[:lng], X_24:bat[:lng], nil:BAT, nil:BAT, true:bit, true:bit, false:bit, false:bit, nil:lng); + X_130:bat[:int] := algebra.projection(X_122:bat[:oid], X_114:bat[:int]); + X_146:bat[:bte] := algebra.project(X_130:bat[:int], 1:bte); + C_100:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 1:int, 4:int); + X_110:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 1:int, 4:int); + X_115:bat[:int] := algebra.projection(C_100:bat[:oid], X_110:bat[:int]); X_119:bat[:lng] := batcalc.lng(X_115:bat[:int]); - C_14:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str); - X_16:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int); - X_17:bat[:int] := algebra.projection(C_14:bat[:oid], X_16:bat[:int]); - X_18:bat[:lng] := batcalc.lng(X_17:bat[:int]); - X_21:bat[:lng] := batcalc.-(X_18:bat[:lng], 1:lng, nil:BAT); - X_26:bat[:lng] := batcalc.+(X_18:bat[:lng], 1:lng, nil:BAT); - X_123:bat[:oid] := algebra.rangejoin(X_119:bat[:lng], X_21:bat[:lng], X_26:bat[:lng], nil:BAT, nil:BAT, true:bit, true:bit, false:bit, false:bit, nil:lng); - X_131:bat[:int] := algebra.projection(X_123:bat[:oid], X_115:bat[:int]); - X_151:bat[:bte] := algebra.project(X_131:bat[:int], 1:bte); - C_101:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 1:int, 4:int); - X_111:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 1:int, 4:int); - X_116:bat[:int] := algebra.projection(C_101:bat[:oid], X_111:bat[:int]); + X_124:bat[:oid] := algebra.rangejoin(X_119:bat[:lng], X_19:bat[:lng], X_24:bat[:lng], nil:BAT, nil:BAT, true:bit, true:bit, false:bit, false:bit, nil:lng); + X_131:bat[:int] := algebra.projection(X_124:bat[:oid], X_115:bat[:int]); + X_147:bat[:bte] := algebra.project(X_131:bat[:int], 1:bte); + C_102:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 2:int, 4:int); + X_111:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 2:int, 4:int); + X_116:bat[:int] := algebra.projection(C_102:bat[:oid], X_111:bat[:int]); X_120:bat[:lng] := batcalc.lng(X_116:bat[:int]); - X_125:bat[:oid] := algebra.rangejoin(X_120:bat[:lng], X_21:bat[:lng], X_26:bat[:lng], nil:BAT, nil:BAT, true:bit, true:bit, false:bit, false:bit, nil:lng); - X_132:bat[:int] := algebra.projection(X_125:bat[:oid], X_116:bat[:int]); - X_152:bat[:bte] := algebra.project(X_132:bat[:int], 1:bte); - C_103:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 2:int, 4:int); - X_112:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 2:int, 4:int); - X_117:bat[:int] := algebra.projection(C_103:bat[:oid], X_112:bat[:int]); + X_126:bat[:oid] := algebra.rangejoin(X_120:bat[:lng], X_19:bat[:lng], X_24:bat[:lng], nil:BAT, nil:BAT, true:bit, true:bit, false:bit, false:bit, nil:lng); + X_132:bat[:int] := algebra.projection(X_126:bat[:oid], X_116:bat[:int]); + X_148:bat[:bte] := algebra.project(X_132:bat[:int], 1:bte); + C_104:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 3:int, 4:int); + X_112:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 3:int, 4:int); + X_117:bat[:int] := algebra.projection(C_104:bat[:oid], X_112:bat[:int]); X_121:bat[:lng] := batcalc.lng(X_117:bat[:int]); - X_127:bat[:oid] := algebra.rangejoin(X_121:bat[:lng], X_21:bat[:lng], X_26:bat[:lng], nil:BAT, nil:BAT, true:bit, true:bit, false:bit, false:bit, nil:lng); - X_133:bat[:int] := algebra.projection(X_127:bat[:oid], X_117:bat[:int]); - X_153:bat[:bte] := algebra.project(X_133:bat[:int], 1:bte); - C_105:bat[:oid] := sql.tid(X_4:int, "sys":str, "another_t":str, 3:int, 4:int); - X_113:bat[:int] := sql.bind(X_4:int, "sys":str, "another_t":str, "col1":str, 0:int, 3:int, 4:int); - X_118:bat[:int] := algebra.projection(C_105:bat[:oid], X_113:bat[:int]); - X_122:bat[:lng] := batcalc.lng(X_118:bat[:int]); - X_129:bat[:oid] := algebra.rangejoin(X_122:bat[:lng], X_21:bat[:lng], X_26:bat[:lng], nil:BAT, nil:BAT, true:bit, true:bit, false:bit, false:bit, nil:lng); - X_134:bat[:int] := algebra.projection(X_129:bat[:oid], X_118:bat[:int]); - X_154:bat[:bte] := algebra.project(X_134:bat[:int], 1:bte); - X_163:bat[:bte] := mat.packIncrement(X_151:bat[:bte], 4:int); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list