Changeset: 502001832a25 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=502001832a25
Modified Files:
        sql/server/rel_optimizer.c
        sql/server/rel_propagate.c
        sql/test/BugTracker-2013/Tests/rangejoin_optimizer.Bug-3411.stable.out
        
sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
        sql/test/BugTracker-2017/Tests/caching_stats_bug.6374.stable.out
        sql/test/mergetables/Tests/mergequery.stable.out
Branch: linear-hashing
Log Message:

Cherry picked changeset 48e2688a2061 into linear-hashing.


diffs (196 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
@@ -3943,7 +3943,7 @@ exps_merge_select_rse( mvc *sql, list *l
                                        continue;
                                mine = exp_binop(sql->sa, le->r, re->r, min);
                                maxe = exp_binop(sql->sa, le->f, re->f, max);
-                               fnd = exp_compare2(sql->sa, le->l, mine, maxe, 
le->flag);
+                               fnd = exp_compare2(sql->sa, le->l, mine, maxe, 
CMP_BETWEEN|le->flag);
                        }
                        if (fnd)
                                append(nexps, fnd);
@@ -7787,9 +7787,9 @@ exp_merge_range(sql_allocator *sa, list 
                                            f->flag == cmp_lte)) 
                                                continue;
                                        if (!swap) 
-                                               ne = exp_compare2(sa, le, re, 
rf, compare2range(e->flag, f->flag));
+                                               ne = exp_compare2(sa, le, re, 
rf, CMP_BETWEEN|compare2range(e->flag, f->flag));
                                        else
-                                               ne = exp_compare2(sa, le, rf, 
re, compare2range(f->flag, e->flag));
+                                               ne = exp_compare2(sa, le, rf, 
re, CMP_BETWEEN|compare2range(f->flag, e->flag));
 
                                        list_remove_data(exps, e);
                                        list_remove_data(exps, f);
@@ -7812,7 +7812,7 @@ exp_merge_range(sql_allocator *sa, list 
                                        comp_type ef = (comp_type) e->flag, ff 
= (comp_type) f->flag;
                                
                                        /* both swapped ? */
-                                       if (exp_match_exp(re, rf)) {
+                                       if (exp_match_exp(re, rf)) {
                                                t = re; 
                                                re = le;
                                                le = t;
@@ -7824,7 +7824,7 @@ exp_merge_range(sql_allocator *sa, list 
                                        }
 
                                        /* is left swapped ? */
-                                       if (exp_match_exp(re, lf)) {
+                                       if (exp_match_exp(re, lf)) {
                                                t = re; 
                                                re = le;
                                                le = t;
@@ -7832,14 +7832,14 @@ exp_merge_range(sql_allocator *sa, list 
                                        }
 
                                        /* is right swapped ? */
-                                       if (exp_match_exp(le, rf)) {
+                                       if (exp_match_exp(le, rf)) {
                                                t = rf; 
                                                rf = lf;
                                                lf = t;
                                                ff = swap_compare(ff);
                                        }
 
-                                       if (!exp_match_exp(le, lf))
+                                       if (!exp_match_exp(le, lf))
                                                continue;
 
                                        /* for now only   c1 <[=] x <[=] c2 */ 
@@ -7851,9 +7851,9 @@ exp_merge_range(sql_allocator *sa, list 
                                        if (lt && (ff == cmp_lt || ff == 
cmp_lte)) 
                                                continue;
                                        if (!swap) 
-                                               ne = exp_compare2(sa, le, re, 
rf, compare2range(ef, ff));
+                                               ne = exp_compare2(sa, le, re, 
rf, CMP_BETWEEN|compare2range(ef, ff));
                                        else
-                                               ne = exp_compare2(sa, le, rf, 
re, compare2range(ff, ef));
+                                               ne = exp_compare2(sa, le, rf, 
re, CMP_BETWEEN|compare2range(ff, ef));
 
                                        list_remove_data(exps, e);
                                        list_remove_data(exps, f);
diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c
--- a/sql/server/rel_propagate.c
+++ b/sql/server/rel_propagate.c
@@ -670,7 +670,7 @@ rel_generate_subinserts(sql_query *query
                                sql_exp *e1, *e2;
                                e1 = create_table_part_atom_exp(sql, pt->tpe, 
pt->part.range.minvalue);
                                e2 = create_table_part_atom_exp(sql, pt->tpe, 
pt->part.range.maxvalue);
-                               range = exp_compare2(sql->sa, le, e1, e2, 1);
+                               range = exp_compare2(sql->sa, le, e1, e2, 
cmp_gte|CMP_BETWEEN);
                                full_range = range;
                        } else {
                                assert(pt->with_nills);
diff --git 
a/sql/test/BugTracker-2013/Tests/rangejoin_optimizer.Bug-3411.stable.out 
b/sql/test/BugTracker-2013/Tests/rangejoin_optimizer.Bug-3411.stable.out
--- a/sql/test/BugTracker-2013/Tests/rangejoin_optimizer.Bug-3411.stable.out
+++ b/sql/test/BugTracker-2013/Tests/rangejoin_optimizer.Bug-3411.stable.out
@@ -52,7 +52,7 @@ project (
 | join (
 | | table(sys.t4311) [ "t4311"."a" as "t2"."a" ] COUNT ,
 | | table(sys.t4311) [ "t4311"."a" as "t1"."a", "t4311"."b" as "t1"."b" ] 
COUNT 
-| ) [ "t1"."a" <= "t2"."a" <= "t1"."b" ]
+| ) [ "t1"."a" <= "t2"."a" <= "t1"."b" BETWEEN  ]
 ) [ "t2"."a" ]
 #plan 
 #SELECT t2.a
@@ -67,7 +67,7 @@ project (
 | join (
 | | table(sys.t4311) [ "t4311"."a" as "t2"."a" ] COUNT ,
 | | table(sys.t4311) [ "t4311"."a" as "t1"."a", "t4311"."b" as "t1"."b" ] 
COUNT 
-| ) [ "t1"."a" <= "t2"."a" <= "t1"."b" ]
+| ) [ "t1"."a" <= "t2"."a" <= "t1"."b" BETWEEN  ]
 ) [ "t2"."a" ]
 #drop table t4311;
 
diff --git 
a/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
 
b/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
--- 
a/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
+++ 
b/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
@@ -88,7 +88,7 @@ stdout of test 'memory-consumption-query
 % .plan # table_name
 % rel # name
 % clob # type
-% 2873 # length
+% 2891 # length
 top N (
 | project (
 | | project (
@@ -169,7 +169,7 @@ top N (
 | | | | | ) [ "a3"."t3pkcol" NOT NULL HASHCOL  = "table1"."t1cold113" ],
 | | | | | table(sys.table12) [ "table12"."t12cola1" ] COUNT 
 | | | | ) [ "table12"."t12cola1" = "table1"."t1cola1" ]
-| | | ) [ (((((((((((((((clob[char["table1"."t1cold1"]] as "table1"."t1cold1") 
FILTER ilike (clob "%a%", clob "")) or ((clob[char["table1"."t1cola1"]] as 
"table1"."t1cola1") FILTER ilike (clob "%a%", clob ""))) or 
((clob[char["table1"."t1colb1"]] as "table1"."t1colb1") FILTER ilike (clob 
"%a%", clob ""))) or ((clob[char["table1"."t1cola11"]] as "table1"."t1cola11") 
FILTER ilike (clob "%business%", clob ""))) or ("table1"."t1colc91" >= 
timestamp(7)[char(19) "2016-03-21 05:00:00"])) or ("table1"."t1cola101" = 
tinyint "1")) or ((clob[char["table1"."t1cola12"]] as "table1"."t1cola12") 
FILTER ilike (clob "%Vijay%", clob ""))) or ((clob[char["table2"."t2cola1"]] as 
"table2"."t2cola1") ! FILTER ilike (clob "%gmail%", clob ""), 
(clob[char["table2"."t2cola1"]] as "table2"."t2cola1") ! FILTER ilike (clob 
"%yahoo%", clob ""))) or ((clob[char["table2"."t2cola1"]] as 
"table2"."t2cola1") FILTER ilike (clob "%efequitygroup.com%", clob ""))) or 
("table4"."t4cola1" = clob "Customer")) or (sys.isnull
 ("table4"."t4cola2") NOT NULL = boolean "false")) or ("table2"."t2cola81" >= 
date "2009-08-31")) or ((("table5"."t5cola1" = clob "BAT") or 
((clob[char["table5"."t5cola2"]] as "table5"."t5cola2") FILTER ilike (clob 
"%AUSTRALIA%", clob ""))) or ((clob[char["table5"."t5cola2"]] as 
"table5"."t5cola2") FILTER ilike (clob "%Monet%", clob ""), "table5"."t5cola3" 
= clob "Facebook", "table5"."t5cola5" = clob "new", "table5"."t5cola81" > date 
"2015-07-30"))) or ((("table10"."t10cola1" != clob "Completed", 
"table9"."t9cola1" = clob "Tasks", "table9"."t9cola91" >= timestamp(7)[char(19) 
"2012-01-01 04:32:27"], "table10"."t10cola91" <= timestamp(7)[char(19) 
"2013-01-01 04:32:27"]) or ("table9"."t9cola1" = clob "Events", 
timestamp(7)[char(19) "2012-01-01 04:32:27"] <= "table11"."t11cola91" <= 
timestamp(7)[char(19) "2013-01-01 04:32:27"])) or ("table9"."t9cola1" = clob 
"Calls", timestamp(7)[char(19) "2012-01-01 04:32:27"] <= "table10"."t10cola91" 
<= timestamp(7)[char(19) "2013-01-01 04:32:27"])), s
 
ys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.=("table1"."t1cold111",
 bigint "15842000014793046"), sys.=("table1"."t1cold111", bigint 
"15842000017701488")), sys.=("table1"."t1cold111", bigint 
"15842000000024019")), sys.=("table1"."t1cold111", bigint 
"15842000000074007")), sys.=("table1"."t1cold111", bigint 
"15842000009358096")), sys.=("table1"."t1cold111", bigint 
"15842000010487625")), sys.=("table1"."t1cold111", bigint 
"15842000006731919")), sys.=("table1"."t1cold111", bigint 
"15842000002590112")), sys.=("table1"."t1cold111", bigint 
"15842000000019001")), sys.=("table1"."t1cold111", bigint 
"15842000014923682")), sys.=("table1"."t1cold111", bigint "15842000027547249")) 
= boolean "true") or (sys.or(sys.=("table12"."t12cola1", clob[bigint 
"15842000280111951"]), sys.=("table12"."t12cola1", clob[bigint 
"15842000280163015"])) = boolean "true") ]
+| | | ) [ (((((((((((((((clob[char["table1"."t1cold1"]] as "table1"."t1cold1") 
FILTER ilike (clob "%a%", clob "")) or ((clob[char["table1"."t1cola1"]] as 
"table1"."t1cola1") FILTER ilike (clob "%a%", clob ""))) or 
((clob[char["table1"."t1colb1"]] as "table1"."t1colb1") FILTER ilike (clob 
"%a%", clob ""))) or ((clob[char["table1"."t1cola11"]] as "table1"."t1cola11") 
FILTER ilike (clob "%business%", clob ""))) or ("table1"."t1colc91" >= 
timestamp(7)[char(19) "2016-03-21 05:00:00"])) or ("table1"."t1cola101" = 
tinyint "1")) or ((clob[char["table1"."t1cola12"]] as "table1"."t1cola12") 
FILTER ilike (clob "%Vijay%", clob ""))) or ((clob[char["table2"."t2cola1"]] as 
"table2"."t2cola1") ! FILTER ilike (clob "%gmail%", clob ""), 
(clob[char["table2"."t2cola1"]] as "table2"."t2cola1") ! FILTER ilike (clob 
"%yahoo%", clob ""))) or ((clob[char["table2"."t2cola1"]] as 
"table2"."t2cola1") FILTER ilike (clob "%efequitygroup.com%", clob ""))) or 
("table4"."t4cola1" = clob "Customer")) or (sys.isnull
 ("table4"."t4cola2") NOT NULL = boolean "false")) or ("table2"."t2cola81" >= 
date "2009-08-31")) or ((("table5"."t5cola1" = clob "BAT") or 
((clob[char["table5"."t5cola2"]] as "table5"."t5cola2") FILTER ilike (clob 
"%AUSTRALIA%", clob ""))) or ((clob[char["table5"."t5cola2"]] as 
"table5"."t5cola2") FILTER ilike (clob "%Monet%", clob ""), "table5"."t5cola3" 
= clob "Facebook", "table5"."t5cola5" = clob "new", "table5"."t5cola81" > date 
"2015-07-30"))) or ((("table10"."t10cola1" != clob "Completed", 
"table9"."t9cola1" = clob "Tasks", "table9"."t9cola91" >= timestamp(7)[char(19) 
"2012-01-01 04:32:27"], "table10"."t10cola91" <= timestamp(7)[char(19) 
"2013-01-01 04:32:27"]) or ("table9"."t9cola1" = clob "Events", 
timestamp(7)[char(19) "2012-01-01 04:32:27"] <= "table11"."t11cola91" <= 
timestamp(7)[char(19) "2013-01-01 04:32:27"] BETWEEN )) or ("table9"."t9cola1" 
= clob "Calls", timestamp(7)[char(19) "2012-01-01 04:32:27"] <= 
"table10"."t10cola91" <= timestamp(7)[char(19) "2013-01-01 04:32:
 27"] BETWEEN )), 
sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.or(sys.=("table1"."t1cold111",
 bigint "15842000014793046"), sys.=("table1"."t1cold111", bigint 
"15842000017701488")), sys.=("table1"."t1cold111", bigint 
"15842000000024019")), sys.=("table1"."t1cold111", bigint 
"15842000000074007")), sys.=("table1"."t1cold111", bigint 
"15842000009358096")), sys.=("table1"."t1cold111", bigint 
"15842000010487625")), sys.=("table1"."t1cold111", bigint 
"15842000006731919")), sys.=("table1"."t1cold111", bigint 
"15842000002590112")), sys.=("table1"."t1cold111", bigint 
"15842000000019001")), sys.=("table1"."t1cold111", bigint 
"15842000014923682")), sys.=("table1"."t1cold111", bigint "15842000027547249")) 
= boolean "true") or (sys.or(sys.=("table12"."t12cola1", clob[bigint 
"15842000280111951"]), sys.=("table12"."t12cola1", clob[bigint 
"15842000280163015"])) = boolean "true") ]
 | | ) [ "table1"."t1pkcol" NOT NULL HASHCOL , "table1"."t1cola82", 
"table2"."t2cola10", "table1"."t1cola1", "table1"."t1cola91", "a1"."t3cola1", 
"table2"."t2cola82" ]
 | ) [ "table1"."t1pkcol" NOT NULL HASHCOL , "table1"."t1cola82", 
"table2"."t2cola10", "table1"."t1cola1", "table1"."t1cola91", "a1"."t3cola1" ] 
[ "table2"."t2cola82" NULLS LAST ]
 ) [ bigint "10", bigint "0" ]
diff --git a/sql/test/BugTracker-2017/Tests/caching_stats_bug.6374.stable.out 
b/sql/test/BugTracker-2017/Tests/caching_stats_bug.6374.stable.out
--- a/sql/test/BugTracker-2017/Tests/caching_stats_bug.6374.stable.out
+++ b/sql/test/BugTracker-2017/Tests/caching_stats_bug.6374.stable.out
@@ -44,12 +44,12 @@ stdout of test 'caching_stats_bug.6374` 
 % .plan # table_name
 % rel # name
 % clob # type
-% 46 # length
+% 50 # length
 project (
 | group by (
 | | select (
 | | | table(sys.sub2) [ "mt"."i" ] COUNT 
-| | ) [ int "5" <= "mt"."i" < int "100" ]
+| | ) [ int "5" <= "mt"."i" < int "100" BETWEEN  ]
 | ) [  ] [ sys.count() NOT NULL as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL ]
 #alter table sub1 set read write;
@@ -74,14 +74,14 @@ project (
 | | | | project (
 | | | | | select (
 | | | | | | table(sys.sub1) [ "sub1"."i" as "mt"."i" ] COUNT 
-| | | | | ) [ int "5" <= "mt"."i" < int "100" ]
+| | | | | ) [ int "5" <= "mt"."i" < int "100" BETWEEN  ]
 | | | | ) [ "mt"."i" ]
 | | | ) [  ] [ sys.count() NOT NULL as "%1"."%1" ],
 | | | group by (
 | | | | project (
 | | | | | select (
 | | | | | | table(sys.sub2) [ "sub2"."i" as "mt"."i" ] COUNT 
-| | | | | ) [ int "5" <= "mt"."i" < int "100" ]
+| | | | | ) [ int "5" <= "mt"."i" < int "100" BETWEEN  ]
 | | | | ) [ "mt"."i" ]
 | | | ) [  ] [ sys.count() NOT NULL as "%1"."%1" ]
 | | ) [ "%1"."%1" ]
diff --git a/sql/test/mergetables/Tests/mergequery.stable.out 
b/sql/test/mergetables/Tests/mergequery.stable.out
--- a/sql/test/mergetables/Tests/mergequery.stable.out
+++ b/sql/test/mergetables/Tests/mergequery.stable.out
@@ -95,19 +95,19 @@ barrier X_235:bit := language.dataflow()
     X_6:int := sql.mvc();
     X_155:bat[:dbl] := sql.bind(X_6:int, "sys":str, "part1":str, "x":str, 
0:int, 0:int, 4:int);
     C_148:bat[:oid] := sql.tid(X_6:int, "sys":str, "part1":str, 0:int, 4:int);
-    C_197:bat[:oid] := algebra.select(X_155:bat[:dbl], C_148:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit);
+    C_197:bat[:oid] := algebra.select(X_155:bat[:dbl], C_148:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit, true:bit);
     X_201:bat[:dbl] := algebra.projection(C_197:bat[:oid], X_155:bat[:dbl]);
     X_156:bat[:dbl] := sql.bind(X_6:int, "sys":str, "part1":str, "x":str, 
0:int, 1:int, 4:int);
     C_150:bat[:oid] := sql.tid(X_6:int, "sys":str, "part1":str, 1:int, 4:int);
-    C_198:bat[:oid] := algebra.select(X_156:bat[:dbl], C_150:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit);
+    C_198:bat[:oid] := algebra.select(X_156:bat[:dbl], C_150:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit, true:bit);
     X_202:bat[:dbl] := algebra.projection(C_198:bat[:oid], X_156:bat[:dbl]);
     X_157:bat[:dbl] := sql.bind(X_6:int, "sys":str, "part1":str, "x":str, 
0:int, 2:int, 4:int);
     C_152:bat[:oid] := sql.tid(X_6:int, "sys":str, "part1":str, 2:int, 4:int);
-    C_199:bat[:oid] := algebra.select(X_157:bat[:dbl], C_152:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit);
+    C_199:bat[:oid] := algebra.select(X_157:bat[:dbl], C_152:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit, true:bit);
     X_203:bat[:dbl] := algebra.projection(C_199:bat[:oid], X_157:bat[:dbl]);
     X_158:bat[:dbl] := sql.bind(X_6:int, "sys":str, "part1":str, "x":str, 
0:int, 3:int, 4:int);
     C_154:bat[:oid] := sql.tid(X_6:int, "sys":str, "part1":str, 3:int, 4:int);
-    C_200:bat[:oid] := algebra.select(X_158:bat[:dbl], C_154:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit);
+    C_200:bat[:oid] := algebra.select(X_158:bat[:dbl], C_154:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit, true:bit);
     X_204:bat[:dbl] := algebra.projection(C_200:bat[:oid], X_158:bat[:dbl]);
     X_221:bat[:dbl] := mat.packIncrement(X_201:bat[:dbl], 4:int);
     X_223:bat[:dbl] := mat.packIncrement(X_221:bat[:dbl], X_202:bat[:dbl]);
@@ -115,7 +115,7 @@ barrier X_235:bit := language.dataflow()
     X_42:bat[:dbl] := mat.packIncrement(X_224:bat[:dbl], X_204:bat[:dbl]);
     X_47:bat[:dbl] := sql.bind(X_6:int, "sys":str, "part2":str, "x":str, 
0:int);
     C_45:bat[:oid] := sql.tid(X_6:int, "sys":str, "part2":str);
-    C_70:bat[:oid] := algebra.select(X_47:bat[:dbl], C_45:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit);
+    C_70:bat[:oid] := algebra.select(X_47:bat[:dbl], C_45:bat[:oid], 1:dbl, 
2:dbl, true:bit, true:bit, false:bit, true:bit);
     X_59:bat[:dbl] := sql.bind(X_6:int, "sys":str, "part2":str, "z":str, 
0:int);
     X_73:bat[:dbl] := algebra.projection(C_70:bat[:oid], X_59:bat[:dbl]);
     X_53:bat[:dbl] := sql.bind(X_6:int, "sys":str, "part2":str, "y":str, 
0:int);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to