Changeset: 79013f33fb25 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=79013f33fb25 Modified Files: sql/storage/store.c Branch: merge-partitions Log Message:
Use BATappend to duplicate a bat diffs (49 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -1493,7 +1493,21 @@ dup_sql_part(sql_allocator *sa, sql_tabl pt->part.range.minlength = opt->part.range.minlength; pt->part.range.maxlength = opt->part.range.maxlength; } else if(isListPartitionTable(ot)) { - //TODO I have to find a function to duplicate a BAT :( + BAT *b = NULL, *o = NULL; + if((o = BATdescriptor(opt->part.values)) == NULL) /* TODO the bat operations might fail :( */ + return NULL; + if ((b = COLnew(0, opt->tpe, BATcount(o), TRANSIENT)) == NULL) { + BBPunfix(o->batCacheid); + return NULL; + } + if(BATappend(b, o, NULL, FALSE) != GDK_SUCCEED) { + BBPunfix(b->batCacheid); + BBPunfix(o->batCacheid); + return NULL; + } + BBPunfix(o->batCacheid); + BBPretain(b->batCacheid); + pt->part.values = b->batCacheid; } return pt; @@ -2466,7 +2480,21 @@ part_dup(sql_trans *tr, int flag, sql_pa pt->part.range.minlength = opt->part.range.minlength; pt->part.range.maxlength = opt->part.range.maxlength; } else if(isListPartitionTable(ot)) { - //TODO I have to find a function to duplicate a BAT :( + BAT *b = NULL, *o = NULL; + if((o = BATdescriptor(opt->part.values)) == NULL) /* TODO the bat operations might fail :( */ + return NULL; + if ((b = COLnew(0, opt->tpe, BATcount(o), TRANSIENT)) == NULL) { + BBPunfix(o->batCacheid); + return NULL; + } + if(BATappend(b, o, NULL, FALSE) != GDK_SUCCEED) { + BBPunfix(b->batCacheid); + BBPunfix(o->batCacheid); + return NULL; + } + BBPunfix(o->batCacheid); + BBPretain(b->batCacheid); + pt->part.values = b->batCacheid; } return pt; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list