Changeset: 2eb5b735df61 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2eb5b735df61
Modified Files:
sql/server/rel_unnest.c
sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
sql/test/miscellaneous/Tests/simple_plans.stable.out
Branch: Jun2020
Log Message:
Reverting some of today's changes. e_cmp expressions inside projections is not
feasible to do
diffs (122 lines):
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -2562,14 +2562,6 @@ rewrite_ifthenelse(mvc *sql, sql_rel *re
return e;
}
-#define is_equal(sf) (strcmp(sf->func->base.name, "=") == 0)
-#define is_not_equal(sf) (strcmp(sf->func->base.name, "<>") == 0)
-#define is_gt(sf) (strcmp(sf->func->base.name, ">") == 0)
-#define is_gte(sf) (strcmp(sf->func->base.name, ">=") == 0)
-#define is_lt(sf) (strcmp(sf->func->base.name, "<") == 0)
-#define is_lte(sf) (strcmp(sf->func->base.name, "<=") == 0)
-#define is_or(sf) (strcmp(sf->func->base.name, "or") == 0)
-
static list *
rewrite_compare_exps(mvc *sql, list *exps, int* changes)
{
@@ -2579,37 +2571,10 @@ rewrite_compare_exps(mvc *sql, list *exp
sql_exp *e = n->data;
if (!is_compare(e->type)) {
- bool rewritten = false;
-
- if (e->type == e_func) {
- sql_subfunc *sf = e->f;
- list *l = e->l;
-
- if (is_equal(sf) || is_not_equal(sf) ||
is_gt(sf) || is_gte(sf) || is_lt(sf) || is_lte(sf)) {
- sql_exp *f = l->h->data;
- sql_exp *s = l->h->next->data;
- n->data = e = exp_compare(sql->sa, f,
s,
is_equal(sf)?cmp_equal:is_not_equal(sf)?cmp_notequal:is_gt(sf)?cmp_gt:is_gte(sf)?cmp_gte:is_lt(sf)?cmp_lt:cmp_lte);
-
- rewritten = true;
- (*changes)++;
- } else if (is_or(sf)) {
- sql_exp *f = l->h->data;
- sql_exp *s = l->h->next->data;
-
- list *l = rewrite_compare_exps(sql,
list_append(new_exp_list(sql->sa), f), changes);
- list *r = rewrite_compare_exps(sql,
list_append(new_exp_list(sql->sa), s), changes);
- n->data = e = exp_or(sql->sa, l, r, 0);
-
- rewritten = true;
- (*changes)++;
- }
- }
-
- if (!rewritten) {
- n->data = e = exp_compare(sql->sa, e,
exp_atom_bool(sql->sa, 1), cmp_equal);
- (*changes)++;
- }
- } else if (is_compare(e->type) && e->flag == cmp_or) {
+ n->data = e = exp_compare(sql->sa, e,
exp_atom_bool(sql->sa, 1), cmp_equal);
+ (*changes)++;
+ }
+ if (is_compare(e->type) && e->flag == cmp_or) {
e->l = rewrite_compare_exps(sql, e->l, changes);
e->r = rewrite_compare_exps(sql, e->r, changes);
}
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
-% 2736 # length
+% 2870 # length
top N (
| project (
| | project (
@@ -177,7 +177,7 @@ top N (
| | | | | ) [ "table1"."t1pkcol" NOT NULL HASHCOL , "table1"."t1cola1",
"table1"."t1cola11", "table1"."t1cola12", "table1"."t1cola82",
"table1"."t1cola91", "table1"."t1cola101", "table1"."t1colb1",
"table1"."t1colb112", "table1"."t1colb113", "table1"."t1colb114",
"table1"."t1colc91", "table1"."t1cold1", "table1"."t1cold111",
"table1"."t1cold112", "table1"."t1cold113", "table4"."t4cola1",
"table4"."t4cola2", "table4"."t4colb111", "table4"."t4colb112",
"table4"."t4colb114", "table4"."t4colb115", "table2"."t2cola1",
"table2"."t2cola10", "table2"."t2cola81", "table2"."t2cola82",
"table2"."t2colc111", "table2"."t2colc112", "table2"."t2colc113",
"table2"."t2colc114", "table2"."t2colc115", "table5"."t5cola1",
"table5"."t5cola2", "table5"."t5cola3", "table5"."t5cola5",
"table5"."t5cola81", "table5"."t5colb113", "lookup3"."t5colb112",
"lookup4"."t7colb113", "lookup5"."t8colb114", "lookup11"."t6pkcol" NOT NULL
HASHCOL , "lookup21"."t2colb112", "lookup31"."t5pkcol" NOT NULL HASHCOL ,
"lookup41
"."t7pkcol" NOT NULL HASHCOL , "lookup51"."t8pkcol" NOT NULL HASHCOL ,
"clookup1"."t6pkcol" NOT NULL HASHCOL , "clookup2"."t2pkcol" NOT NULL HASHCOL ,
"clookup3"."t5pkcol" NOT NULL HASHCOL , "clookup4"."t7pkcol" NOT NULL HASHCOL ,
"clookup5"."t8pkcol" NOT NULL HASHCOL , "table9"."t9pkcol" NOT NULL HASHCOL ,
"table9"."t9cola1", "table9"."t9cola91", "table9"."t9cola111",
"table10"."t10pkcol" NOT NULL HASHCOL , "table10"."t10cola1",
"table10"."t10cola91", "table11"."t11pkcol" NOT NULL HASHCOL ,
"table11"."t11cola91", "a1"."t3pkcol" NOT NULL HASHCOL , "a1"."t3cola1",
"a2"."t3pkcol" NOT NULL HASHCOL , "a3"."t3pkcol" NOT NULL HASHCOL ],
| | | | | 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 ("table4"."
t4cola2" ! * = clob "NULL")) 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 )), ((((
(((((("table1"."t1cold111" = bigint "15842000014793046") or
("table1"."t1cold111" = bigint "15842000017701488")) or ("table1"."t1cold111" =
bigint "15842000000024019")) or ("table1"."t1cold111" = bigint
"15842000000074007")) or ("table1"."t1cold111" = bigint "15842000009358096"))
or ("table1"."t1cold111" = bigint "15842000010487625")) or
("table1"."t1cold111" = bigint "15842000006731919")) or ("table1"."t1cold111" =
bigint "15842000002590112")) or ("table1"."t1cold111" = bigint
"15842000000019001")) or ("table1"."t1cold111" = bigint "15842000014923682"))
or ("table1"."t1cold111" = bigint "15842000027547249")) or
(("table12"."t12cola1" = clob[bigint "15842000280111951"]) or
("table12"."t12cola1" = clob[bigint "15842000280163015"])) ]
+| | | ) [ (((((((((((((((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 ("table4"."
t4cola2" ! * = clob "NULL")) 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/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
@@ -11,31 +11,31 @@ stdout of test 'simple_plans` in directo
% .plan # table_name
% rel # name
% clob # type
-% 138 # length
+% 161 # length
project (
| select (
| | table(sys.myx) [ "myx"."x", "myx"."y" ] COUNT
-| ) [ ("myx"."x" = uuid[char(32) "1aea00e5db6e0810b554fde31d961965"]) or
("myx"."y" = uuid[char(32) "1aea00e5db6e0810b554fde31d961965"]) ]
+| ) [ (sys.=("myx"."x", uuid[char(32) "1aea00e5db6e0810b554fde31d961965"]) =
boolean "true") or ("myx"."y" = uuid[char(32)
"1aea00e5db6e0810b554fde31d961965"]) ]
) [ "myx"."x", "myx"."y" ]
#plan select * from myx where x in ('1aea00e5db6e0810b554fde31d961965') or y
is null;
% .plan # table_name
% rel # name
% clob # type
-% 102 # length
+% 125 # length
project (
| select (
| | table(sys.myx) [ "myx"."x", "myx"."y" ] COUNT
-| ) [ ("myx"."x" = uuid[char(32) "1aea00e5db6e0810b554fde31d961965"]) or
("myx"."y" * = uuid "NULL") ]
+| ) [ (sys.=("myx"."x", uuid[char(32) "1aea00e5db6e0810b554fde31d961965"]) =
boolean "true") or ("myx"."y" * = uuid "NULL") ]
) [ "myx"."x", "myx"."y" ]
#plan select * from myx where x in ('1aea00e5db6e0810b554fde31d961965',
'1aea00e5db6e0810b554fde31d961966') or y = '1aea00e5db6e0810b554fde31d961967';
% .plan # table_name
% rel # name
% clob # type
-% 207 # length
+% 238 # length
project (
| select (
| | table(sys.myx) [ "myx"."x", "myx"."y" ] COUNT
-| ) [ (("myx"."x" = uuid[char(32) "1aea00e5db6e0810b554fde31d961965"]) or
("myx"."x" = uuid[char(32) "1aea00e5db6e0810b554fde31d961966"])) or ("myx"."y"
= uuid[char(32) "1aea00e5db6e0810b554fde31d961967"]) ]
+| ) [ (sys.or(sys.=("myx"."x", uuid[char(32)
"1aea00e5db6e0810b554fde31d961965"]), sys.=("myx"."x", uuid[char(32)
"1aea00e5db6e0810b554fde31d961966"])) = boolean "true") or ("myx"."y" =
uuid[char(32) "1aea00e5db6e0810b554fde31d961967"]) ]
) [ "myx"."x", "myx"."y" ]
#insert into myx values ('1aea00e5db6e0810b554fde31d961965',
'1aea00e5db6e0810b554fde31d961967');
[ 1 ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list