[prev in list] [next in list] [prev in thread] [next in thread] 

List:       monetdb-checkins
Subject:    MonetDB: Jun2020 - Small sqlancer bugfix, if the input expressio...
From:       Pedro_Ferreira <commits+pedro.ferreira=monetdbsolutions.com () mon
Date:       2020-07-31 12:29:42
Message-ID: hg.ed17a39fdb5d.1596198582.-5019145735949780798 () monetdb-vm0 ! spin-off ! cwi ! nl
[Download RAW message or body]

Changeset: ed17a39fdb5d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ed17a39fdb5d
Modified Files:
	sql/server/rel_optimizer.c
	sql/test/SQLancer/Tests/sqlancer01.sql
	sql/test/SQLancer/Tests/sqlancer01.stable.out
Branch: Jun2020
Log Message:

Small sqlancer bugfix, if the input expression is cmp_notequal, the flag has to be \
negated again


diffs (97 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
@@ -7795,6 +7795,8 @@ rel_simplify_predicates(visitor *v, sql_
 
 							if (!strcmp(inf->func->base.name, "<>"))
 								flag = !flag;
+							if (e->flag == cmp_notequal)
+								flag = !flag;
 							assert(list_length(args) == 2);
 							l = args->h->data;
 							r = args->h->next->data;
diff --git a/sql/test/SQLancer/Tests/sqlancer01.sql \
                b/sql/test/SQLancer/Tests/sqlancer01.sql
--- a/sql/test/SQLancer/Tests/sqlancer01.sql
+++ b/sql/test/SQLancer/Tests/sqlancer01.sql
@@ -319,6 +319,23 @@ create view v1(c0) as (select distinct t
 select max(all abs(+ (- (- (-1620427795))))) from v0, t0 join v1 on \
((((v1.c0)||(t0.c1)))ilike(v1.c0));  ROLLBACK;
 
+START TRANSACTION;
+CREATE TABLE "sys"."t1" ("c0" VARCHAR(427),"c1" TIME);
+COPY 5 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+"-"	NULL
+"0.9494786438610024"	NULL
+"MA4DƹXb,⻇멫ho\trYmꈋP-aR"	NULL
+NULL	02:45:58
+NULL	05:45:05
+
+SELECT MEDIAN(ALL abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP \
'1970-01-19 10:35:50' THEN 2 END)) FROM t1 GROUP BY abs(0.8); +SELECT MEDIAN(ALL \
abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP '1970-01-19 10:35:50' THEN 2 \
END)) FROM t1 GROUP BY abs(0.8) HAVING (NOT (MIN(ALL NOT (NOT ((0.7) IS NULL))))) = \
TRUE +UNION ALL
+SELECT MEDIAN(ALL abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP \
'1970-01-19 10:35:50' THEN 2 END)) FROM t1 GROUP BY abs(0.8) HAVING NOT ((NOT \
(MIN(ALL NOT (NOT ((0.7) IS NULL))))) = TRUE) +UNION ALL
+SELECT MEDIAN(ALL abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP \
'1970-01-19 10:35:50' THEN 2 END)) FROM t1 GROUP BY abs(0.8) HAVING ((NOT (MIN(ALL \
NOT (NOT ((0.7) IS NULL))))) = TRUE) IS NULL; +ROLLBACK;
+
 DROP TABLE tbl_ProductSales;
 DROP TABLE another_T;
 DROP TABLE integers;
diff --git a/sql/test/SQLancer/Tests/sqlancer01.stable.out \
                b/sql/test/SQLancer/Tests/sqlancer01.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer01.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer01.stable.out
@@ -213,8 +213,8 @@ stdout of test 'sqlancer01` in directory
 % int # type
 % 1 # length
 #select 1 from another_t join integers on (cast(another_t.col4 between 1 and 2 as \
                int)) where false;
-% .%15 # table_name
-% %15 # name
+% .%11 # table_name
+% %11 # name
 % tinyint # type
 % 1 # length
 #SELECT another_T.col2 FROM tbl_productsales, integers LEFT OUTER JOIN another_T ON \
another_T.col1 > 1 WHERE another_T.col2 > 1 GROUP BY another_T.col2 HAVING \
COUNT((another_T.col2) IN (another_T.col2)) > 0; @@ -272,8 +272,8 @@ stdout of test \
'sqlancer01` in directory  % 1 # length
 [ 1	]
 #select 1 from t0 where (3 in (1, 2)) is null; --simplified
-% .%5 # table_name
-% %5 # name
+% .%4 # table_name
+% %4 # name
 % tinyint # type
 % 1 # length
 #SELECT 1 FROM t0 WHERE t0.c0 BETWEEN SYMMETRIC (1 IN (2, 1)) AND t0.c0;
@@ -625,6 +625,32 @@ stdout of test 'sqlancer01` in directory
 % 1 # length
 [ NULL	]
 #ROLLBACK;
+#START TRANSACTION;
+#CREATE TABLE "sys"."t1" ("c0" VARCHAR(427),"c1" TIME);
+#COPY 5 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+#"-"	NULL
+#"0.9494786438610024"	NULL
+#"MA4DƹXb,⻇멫ho\trYmꈋP-aR"	NULL
+#NULL	02:45:58
+#NULL	05:45:05
+[ 5	]
+#SELECT MEDIAN(ALL abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP \
'1970-01-19 10:35:50' THEN 2 END)) FROM t1 GROUP BY abs(0.8); +% .%2 # table_name
+% %2 # name
+% tinyint # type
+% 1 # length
+[ NULL	]
+#SELECT MEDIAN(ALL abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP \
'1970-01-19 10:35:50' THEN 2 END)) FROM t1 GROUP BY abs(0.8) HAVING (NOT (MIN(ALL NOT \
(NOT ((0.7) IS NULL))))) = TRUE +#UNION ALL
+#SELECT MEDIAN(ALL abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP \
'1970-01-19 10:35:50' THEN 2 END)) FROM t1 GROUP BY abs(0.8) HAVING NOT ((NOT \
(MIN(ALL NOT (NOT ((0.7) IS NULL))))) = TRUE) +#UNION ALL
+#SELECT MEDIAN(ALL abs(CASE TIMESTAMP '1970-01-24 09:25:06' WHEN TIMESTAMP \
'1970-01-19 10:35:50' THEN 2 END)) FROM t1 GROUP BY abs(0.8) HAVING ((NOT (MIN(ALL \
NOT (NOT ((0.7) IS NULL))))) = TRUE) IS NULL; +% .%23 # table_name
+% %2 # name
+% tinyint # type
+% 1 # length
+[ NULL	]
+#ROLLBACK;
 #DROP TABLE tbl_ProductSales;
 #DROP TABLE another_T;
 #DROP TABLE integers;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic