Changeset: a8891898409f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a8891898409f
Modified Files:
sql/server/rel_optimizer.c
sql/test/SQLancer/Tests/sqlancer14.test
Branch: default
Log Message:
The multiplication function may not be avaible for some integer combinations,
so compute supertype of the constants
diffs (83 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
@@ -3108,6 +3108,10 @@ exp_simplify_math( mvc *sql, sql_exp *e,
sql_subtype et =
*exp_subtype(e);
/* (x*c1)*c2 -> x * (c1*c2) */
list *l = sa_list(sql->sa);
+
+ /* lre and re may have
different types, so compute supertype */
+ if (rel_convert_types(sql,
NULL, NULL, &lre, &re, 1, type_equal) < 0)
+ return NULL;
append(l, lre);
append(l, re);
le->l = l;
@@ -3170,7 +3174,8 @@ exp_simplify_math( mvc *sql, sql_exp *e,
/* (x+c1)+y -> (x+y) + c1 */
ll->h->next->data = re;
l->h->next->data = lre;
- l->h->data =
exp_simplify_math(sql, le, changes);
+ if (!(l->h->data =
exp_simplify_math(sql, le, changes)))
+ return NULL;
(*changes)++;
return e;
}
@@ -3178,7 +3183,8 @@ exp_simplify_math( mvc *sql, sql_exp *e,
/* (x+c1)+c2 -> (c2+c1) + x */
ll->h->data = re;
l->h->next->data = lle;
- l->h->data =
exp_simplify_math(sql, le, changes);
+ if (!(l->h->data =
exp_simplify_math(sql, le, changes)))
+ return NULL;
(*changes)++;
return e;
}
@@ -3258,7 +3264,8 @@ exp_simplify_math( mvc *sql, sql_exp *e,
l->h->next->data = lre;
le->f = e->f;
e->f = f;
- l->h->data =
exp_simplify_math(sql, le, changes);
+ if (!(l->h->data =
exp_simplify_math(sql, le, changes)))
+ return NULL;
(*changes)++;
return e;
}
@@ -3269,7 +3276,8 @@ exp_simplify_math( mvc *sql, sql_exp *e,
l->h->next->data = lle;
le->f = e->f;
e->f = f;
- l->h->data =
exp_simplify_math(sql, le, changes);
+ if (!(l->h->data =
exp_simplify_math(sql, le, changes)))
+ return NULL;
(*changes)++;
return e;
}
@@ -3278,10 +3286,12 @@ exp_simplify_math( mvc *sql, sql_exp *e,
}
if (l)
for (n = l->h; n; n = n->next)
- n->data = exp_simplify_math(sql, n->data,
changes);
+ if (!(n->data = exp_simplify_math(sql, n->data,
changes)))
+ return NULL;
}
if (e->type == e_convert)
- e->l = exp_simplify_math(sql, e->l, changes);
+ if (!(e->l = exp_simplify_math(sql, e->l, changes)))
+ return NULL;
return e;
}
diff --git a/sql/test/SQLancer/Tests/sqlancer14.test
b/sql/test/SQLancer/Tests/sqlancer14.test
--- a/sql/test/SQLancer/Tests/sqlancer14.test
+++ b/sql/test/SQLancer/Tests/sqlancer14.test
@@ -311,8 +311,8 @@ 12.000 1578787758
query R rowsort
select var_pop(-983102429*(0.3*t2.c0)) from t2 union all select
var_pop(-983102429*(0.3*t2.c0)) from t2
----
-1709093873140383929.03637542
-1709093873140383929.03637542
+1709093873140383744.000
+1709093873140383744.000
statement ok
ROLLBACK
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list