Changeset: f3142154eb23 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f3142154eb23
Modified Files:
sql/backends/monet5/rel_bin.c
sql/storage/bat/bat_storage.c
Branch: default
Log Message:
make sure we create new columns of the right length (ie including deleted rows)
diffs (58 lines):
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2977,6 +2977,29 @@ rel2bin_distinct(backend *be, stmt *s, s
}
static stmt *
+rel2bin_single(backend *be, stmt *s)
+{
+ if (s->key && s->nrcols == 0)
+ return s;
+
+ mvc *sql = be->mvc;
+ list *rl = sa_list(sql->sa);
+
+ for (node *n = s->op4.lval->h; n; n = n->next) {
+ stmt *t = n->data;
+ const char *rnme = table_name(sql->sa, t);
+ const char *nme = column_name(sql->sa, t);
+ sql_subfunc *zero_or_one = sql_bind_func(sql, "sys",
"zero_or_one", tail_type(t), NULL, F_AGGR);
+
+ t = stmt_aggr(be, t, NULL, NULL, zero_or_one, 1, 0, 1);
+ t = stmt_alias(be, t, rnme, nme);
+ list_append(rl, t);
+ }
+ s = stmt_list(be, rl);
+ return s;
+}
+
+static stmt *
rel_rename(backend *be, sql_rel *rel, stmt *sub)
{
mvc *sql = be->mvc;
@@ -3038,6 +3061,8 @@ rel2bin_union(backend *be, sql_rel *rel,
sub = rel_rename(be, rel, sub);
if (need_distinct(rel))
sub = rel2bin_distinct(be, sub, NULL);
+ if (rel->single)
+ sub = rel2bin_single(be, sub);
return sub;
}
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -1634,8 +1634,10 @@ create_col(sql_trans *tr, sql_column *c)
size_t cnt = 0;
/* alter ? */
- if (ol_first_node(c->t->columns) && (fc =
ol_first_node(c->t->columns)->data) != NULL)
- cnt = count_col(tr, fc, 1);
+ if (ol_first_node(c->t->columns) && (fc =
ol_first_node(c->t->columns)->data) != NULL) {
+ storage *s = fc->t->data;
+ cnt = segs_end(s->segs, tr);
+ }
if (cnt && fc != c) {
sql_delta *d = ATOMIC_PTR_GET(&fc->data);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list