Changeset: 258d840a4acc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/258d840a4acc
Modified Files:
gdk/gdk_bat.c
sql/backends/monet5/rel_predicates.c
Branch: Jan2022
Log Message:
Merged with Jul2021
diffs (134 lines):
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -821,12 +821,19 @@ COLcopy(BAT *b, int tt, bool writable, r
} else if (BATatoms[tt].atomFix) {
/* oops, we need to fix/unfix atoms */
slowcopy = true;
- } else if (bi.h && bi.h->parentid != b->batCacheid) {
- /* extra checks needed for views */
- if (BATcapacity(BBP_cache(bi.h->parentid)) > bi.count +
bi.count)
- /* reduced slice view: do not copy too
- * much garbage */
- slowcopy = true;
+ } else if (bi.h && bi.h->parentid != b->batCacheid &&
+ BATcapacity(BBP_cache(bi.h->parentid)) > bi.count +
bi.count) {
+ /* reduced slice view: do not copy too much
+ * garbage */
+ slowcopy = true;
+ } else if (bi.vh && bi.vh->parentid != b->batCacheid &&
+ BATcount(BBP_cache(bi.vh->parentid)) > bi.count +
bi.count) {
+ /* reduced vheap view: do not copy too much
+ * garbage; this really is a heuristic since the
+ * vheap could be used completely, even if the
+ * offset heap is only (less than) half the size
+ * of the parent's offset heap */
+ slowcopy = true;
}
bn = COLnew2(b->hseqbase, tt, bi.count, role, bi.width);
diff --git a/sql/backends/monet5/rel_predicates.c
b/sql/backends/monet5/rel_predicates.c
--- a/sql/backends/monet5/rel_predicates.c
+++ b/sql/backends/monet5/rel_predicates.c
@@ -16,7 +16,7 @@
static sql_column *
bt_find_column( sql_rel *rel, char *tname, char *name)
{
- if (!rel || !rel->exps || !rel->l)
+ if (!rel || list_empty(rel->exps) || !rel->l)
return NULL;
sql_exp *ne = NULL;
sql_table *t = rel->l;
@@ -43,48 +43,52 @@ rel_find_predicates(visitor *v, sql_rel
if (is_basetable(rel->op)) {
sql_table *t = rel->l;
- if (!t || !rel->exps || isNew(t) || !isGlobal(t) ||
isGlobalTemp(t))
+ if (!t || list_empty(rel->exps) || isNew(t) || !isGlobal(t) ||
isGlobalTemp(t))
return rel;
sql_rel *parent = v->parent;
/* select with basetable */
if (is_select(parent->op)) {
/* add predicates */
- for (node *n = parent->exps->h; n && !needall; n =
n->next) {
- sql_exp *e = n->data, *r = e->r, *r2 = e->f;
- sql_column *c = NULL;
+ if (list_empty(parent->exps)) {
+ needall = true;
+ } else {
+ for (node *n = parent->exps->h; n && !needall;
n = n->next) {
+ sql_exp *e = n->data, *r = e->r, *r2 =
e->f;
+ sql_column *c = NULL;
- if (!is_compare(e->type) ||
!is_theta_exp(e->flag) || r->type != e_atom || !r->l || (r2 && (r2->type !=
e_atom || !r2->l)) || is_symmetric(e) || !(c = exp_find_column(rel, e->l))) {
- needall = true;
- } else if (isNew(c)) {
- continue;
- } else {
- atom *e1 = r && r->l ? atom_copy(NULL,
r->l) : NULL, *e2 = r2 && r2->l ? atom_copy(NULL, r2->l) : NULL;
+ if (!is_compare(e->type) ||
!is_theta_exp(e->flag) || r->type != e_atom || !r->l || (r2 && (r2->type !=
e_atom || !r2->l)) || is_symmetric(e) || !(c = exp_find_column(rel, e->l))) {
+ needall = true;
+ } else if (isNew(c)) {
+ continue;
+ } else {
+ atom *e1 = r && r->l ?
atom_copy(NULL, r->l) : NULL, *e2 = r2 && r2->l ? atom_copy(NULL, r2->l) : NULL;
- if ((r && r->l && !e1) || (r2 && r2->l
&& !e2)) {
- if (e1) {
- VALclear(&e1->data);
- _DELETE(e1);
+ if ((r && r->l && !e1) || (r2
&& r2->l && !e2)) {
+ if (e1) {
+
VALclear(&e1->data);
+ _DELETE(e1);
+ }
+ if (e2) {
+
VALclear(&e2->data);
+ _DELETE(e2);
+ }
+ return
sql_error(v->sql, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
- if (e2) {
- VALclear(&e2->data);
- _DELETE(e2);
+
+ if
(sql_trans_add_predicate(v->sql->session->tr, c, e->flag, e1, e2, is_anti(e),
is_semantics(e)) != LOG_OK) {
+ if (e1) {
+
VALclear(&e1->data);
+ _DELETE(e1);
+ }
+ if (e2) {
+
VALclear(&e2->data);
+ _DELETE(e2);
+ }
+ return
sql_error(v->sql, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
- return sql_error(v->sql, 10,
SQLSTATE(HY013) MAL_MALLOC_FAIL);
+ v->changes++;
}
-
- if
(sql_trans_add_predicate(v->sql->session->tr, c, e->flag, e1, e2, is_anti(e),
is_semantics(e)) != LOG_OK) {
- if (e1) {
- VALclear(&e1->data);
- _DELETE(e1);
- }
- if (e2) {
- VALclear(&e2->data);
- _DELETE(e2);
- }
- return sql_error(v->sql, 10,
SQLSTATE(HY013) MAL_MALLOC_FAIL);
- }
- v->changes++;
}
}
}
@@ -93,7 +97,7 @@ rel_find_predicates(visitor *v, sql_rel
/* any other case, add all predicates */
sql_table *t = rel->l;
- if (!t || !rel->exps || isNew(t) || !isGlobal(t) ||
isGlobalTemp(t))
+ if (!t || list_empty(rel->exps) || isNew(t) ||
!isGlobal(t) || isGlobalTemp(t))
return rel;
for (node *n = rel->exps->h; n; n = n->next) {
sql_exp *e = n->data;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list