Changeset: b762adf5ac10 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b762adf5ac10
Added Files:
        sql/test/SQLancer/Tests/sqlancer06.sql
        sql/test/SQLancer/Tests/sqlancer06.stable.err
        sql/test/SQLancer/Tests/sqlancer06.stable.out
Modified Files:
        sql/server/rel_optimizer.c
        sql/test/SQLancer/Tests/All
Branch: Oct2020
Log Message:

Look for anti flag


diffs (106 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
@@ -7586,9 +7586,12 @@ rel_simplify_predicates(visitor *v, sql_
                                                atom *a = r->l;
 
                                                if (a->isnull) {
-                                                       if (is_semantics(e)) /* 
isnull(x) = NULL -> false, isnull(x) <> NULL -> true */
-                                                               e = 
exp_atom_bool(v->sql->sa, e->flag == cmp_notequal);
-                                                       else /* always NULL */
+                                                       if (is_semantics(e)) { 
/* isnull(x) = NULL -> false, isnull(x) <> NULL -> true */
+                                                               int flag = 
e->flag == cmp_notequal;
+                                                               if (is_anti(e))
+                                                                       flag = 
!flag;
+                                                               e = 
exp_atom_bool(v->sql->sa, flag);
+                                                       } else /* always NULL */
                                                                e = 
exp_null(v->sql->sa, sql_bind_localtype("bit"));
                                                        v->changes++;
                                                } else {
diff --git a/sql/test/SQLancer/Tests/All b/sql/test/SQLancer/Tests/All
--- a/sql/test/SQLancer/Tests/All
+++ b/sql/test/SQLancer/Tests/All
@@ -3,3 +3,4 @@ sqlancer02
 sqlancer03
 sqlancer04
 sqlancer05
+sqlancer06
diff --git a/sql/test/SQLancer/Tests/sqlancer06.sql 
b/sql/test/SQLancer/Tests/sqlancer06.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/SQLancer/Tests/sqlancer06.sql
@@ -0,0 +1,16 @@
+START TRANSACTION;
+CREATE TABLE "sys"."t2" (
+       "c0" DOUBLE        NOT NULL,
+       "c1" INTERVAL MONTH,
+       CONSTRAINT "t2_c0_pkey" PRIMARY KEY ("c0"),
+       CONSTRAINT "t2_c1_c0_unique" UNIQUE ("c1", "c0")
+);
+COPY 1 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+1662973479     1626041622
+
+SELECT ALL t2.c0 FROM t2 WHERE ((COALESCE(0.9, 0.5, 0.7, 0.6, 0.8)) IS NULL) 
IS NOT NULL;
+       -- 1662973479
+SELECT CAST(SUM(count) AS BIGINT) FROM (SELECT ALL CAST(((COALESCE(0.9, 0.5, 
0.7, 0.6, 0.8)) IS NULL) IS NOT NULL AS INT) 
+as count FROM t2) as res;
+       -- 1
+ROLLBACK;
diff --git a/sql/test/SQLancer/Tests/sqlancer06.stable.err 
b/sql/test/SQLancer/Tests/sqlancer06.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/SQLancer/Tests/sqlancer06.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'sqlancer06` in directory 'sql/test/SQLancer` itself:
+
+
+# 19:38:32 >  
+# 19:38:32 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-506117" "--port=38597"
+# 19:38:32 >  
+
+
+# 19:38:32 >  
+# 19:38:32 >  "Done."
+# 19:38:32 >  
+
diff --git a/sql/test/SQLancer/Tests/sqlancer06.stable.out 
b/sql/test/SQLancer/Tests/sqlancer06.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/SQLancer/Tests/sqlancer06.stable.out
@@ -0,0 +1,36 @@
+stdout of test 'sqlancer06` in directory 'sql/test/SQLancer` itself:
+
+
+# 19:38:32 >  
+# 19:38:32 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-506117" "--port=38597"
+# 19:38:32 >  
+
+#START TRANSACTION;
+#CREATE TABLE "sys"."t2" (
+#      "c0" DOUBLE        NOT NULL,
+#      "c1" INTERVAL MONTH,
+#      CONSTRAINT "t2_c0_pkey" PRIMARY KEY ("c0"),
+#      CONSTRAINT "t2_c1_c0_unique" UNIQUE ("c1", "c0")
+#);
+#COPY 1 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+#1662973479    1626041622
+[ 1    ]
+#SELECT ALL t2.c0 FROM t2 WHERE ((COALESCE(0.9, 0.5, 0.7, 0.6, 0.8)) IS NULL) 
IS NOT NULL;
+% sys.t2 # table_name
+% c0 # name
+% double # type
+% 24 # length
+[ 1662973479   ]
+#SELECT CAST(SUM(count) AS BIGINT) FROM (SELECT ALL CAST(((COALESCE(0.9, 0.5, 
0.7, 0.6, 0.8)) IS NULL) IS NOT NULL AS INT) 
+#as count FROM t2) as res;
+% .%3 # table_name
+% %3 # name
+% bigint # type
+% 1 # length
+[ 1    ]
+#ROLLBACK;
+
+# 19:38:32 >  
+# 19:38:32 >  "Done."
+# 19:38:32 >  
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to