Changeset: 8a163d530b43 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8a163d530b43
Modified Files:
        monetdb5/optimizer/opt_for.c
        sql/test/dict/Tests/dict01.test
Branch: Jan2022
Log Message:

Exclude unary batcalc.- from for rewrite


diffs (42 lines):

diff --git a/monetdb5/optimizer/opt_for.c b/monetdb5/optimizer/opt_for.c
--- a/monetdb5/optimizer/opt_for.c
+++ b/monetdb5/optimizer/opt_for.c
@@ -197,9 +197,11 @@ OPTforImplementation(Client cntxt, MalBl
                                        freeInstruction(p);
                                        done = 1;
                                        break;
-                               } else if ((isMapOp(p) || isMap2Op(p)) && 
(getFunctionId(p) == plusRef || getFunctionId(p) == minusRef)  && 
allConstExcept(mb, p, j)) {
+                               } else if ((isMapOp(p) || isMap2Op(p)) && 
(getFunctionId(p) == plusRef || getFunctionId(p) == minusRef) &&
+                                                       p->argc > 2 && 
getBatType(getArgType(mb, p, 2)) != TYPE_oid && allConstExcept(mb, p, j)) {
+                                       /* filter out unary batcalc.- with and 
without a candidate list */
                                        /* batcalc.-(1, col) with col = 
for.decompress(o,min_val)
-                                        * v1 = batcalc.-(1, min_val)
+                                        * v1 = calc.-(1, min_val)
                                         * for.decompress(o, v1) */
                                        /* we assume binary operators only ! */
                                        InstrPtr r = newInstructionArgs(mb, 
calcRef, getFunctionId(p), 3);
diff --git a/sql/test/dict/Tests/dict01.test b/sql/test/dict/Tests/dict01.test
--- a/sql/test/dict/Tests/dict01.test
+++ b/sql/test/dict/Tests/dict01.test
@@ -694,6 +694,21 @@ statement ok
 COMMIT
 
 statement ok
+CREATE TABLE "t1" ("c0" BIGINT NOT NULL)
+
+statement ok
+INSERT INTO "t1" VALUES (-1981639662)
+
+statement ok
+CALL "sys"."for_compress"('sys','t1','c0')
+
+statement ok rowcount 0
+UPDATE t1 SET c0 = 1 FROM t1 tx WHERE -t1.c0 = 2
+
+statement ok
+DROP TABLE t1
+
+statement ok
 START TRANSACTION
 
 statement ok
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to