Changeset: 59fa6a46846a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=59fa6a46846a Modified Files: clients/Tests/exports.stable.out gdk/ChangeLog.Mar2018 gdk/gdk.h gdk/gdk_align.c gdk/gdk_bat.c gdk/gdk_batop.c monetdb5/modules/mal/iterator.c sql/backends/monet5/sql_fround_impl.h sql/backends/monet5/sql_round_impl.h Branch: Mar2018 Log Message:
Cleanup: removed ALIGNsetH, ALIGNsetT, and VIEWcreate_ (with underscore). diffs (289 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -6,8 +6,6 @@ stdout of test 'exports` in directory 'c # 21:40:57 > # gdk -void ALIGNsetH(BAT *b1, BAT *b2); -void ALIGNsetT(BAT *b1, BAT *b2); int ALIGNsynced(BAT *b1, BAT *b2); int ATOMallocate(const char *nme); ptr ATOMdup(int id, const void *val); @@ -362,7 +360,6 @@ gdk_return VARcalcxor(ValPtr ret, const gdk_return VARconvert(ValPtr ret, const ValRecord *v, int abort_on_error); void VIEWbounds(BAT *b, BAT *view, BUN l, BUN h); BAT *VIEWcreate(oid seq, BAT *b); -BAT *VIEWcreate_(oid seq, BAT *b, int stable); size_t _MT_npages; size_t _MT_pagesize; const union _dbl_nil_t _dbl_nil_; diff --git a/gdk/ChangeLog.Mar2018 b/gdk/ChangeLog.Mar2018 --- a/gdk/ChangeLog.Mar2018 +++ b/gdk/ChangeLog.Mar2018 @@ -1,6 +1,12 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Fri Feb 9 2018 Sjoerd Mullender <sjo...@acm.org> +- Removed functions ALIGNsetH, ALIGNsetT, and CREATEview_ (mind the + underscore). The first can easily be replace by using BAThseqbase + (that's all it did), the second was only used once, and the third can + be replace by VIEWcreate. + * Thu Jan 18 2018 Sjoerd Mullender <sjo...@acm.org> - Removed unused functions BATmemsize and BATvmsize. - Removed the tnodense property: it was maintained but never actually diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2523,8 +2523,6 @@ gdk_export void BATundo(BAT *b); * @tab ALIGNsync (BAT *b1, BAT *b2) * @item int * @tab ALIGNrelated (BAT *b1, BAT *b2) - * @item int - * @tab ALIGNsetT ((BAT *dst, BAT *src) * * @item BAT* * @tab VIEWcreate (oid seq, BAT *b) @@ -2572,13 +2570,8 @@ gdk_export void BATassertProps(BAT *b); #define BATPROPS_CHECK 3 /* BATPROPS_ALL, but start from scratch and report illegally set properties */ gdk_export BAT *VIEWcreate(oid seq, BAT *b); -gdk_export BAT *VIEWcreate_(oid seq, BAT *b, int stable); gdk_export void VIEWbounds(BAT *b, BAT *view, BUN l, BUN h); -/* low level functions */ -gdk_export void ALIGNsetH(BAT *b1, BAT *b2); -gdk_export void ALIGNsetT(BAT *b1, BAT *b2); - #define ALIGNinp(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ|BAT_APPEND,e); } while (0) #define ALIGNapp(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ,e); } while (0) diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -49,61 +49,13 @@ #include "gdk.h" #include "gdk_private.h" -void -ALIGNsetH(BAT *b1, BAT *b2) -{ - if (b1 == NULL || b2 == NULL) - return; - - /* b2 is either dense or has a void(nil) tail */ - BAThseqbase(b1, b2->hseqbase); - b1->batDirtydesc = TRUE; -} - -void -ALIGNsetT(BAT *b1, BAT *b2) -{ - if (b1 == NULL || b2 == NULL) - return; - - if (BATtvoid(b2)) { - /* b2 is either dense or has a void(nil) tail */ - if (b1->ttype != TYPE_void) - b1->tdense = TRUE; - else if (is_oid_nil(b2->tseqbase)) - b1->tnonil = FALSE; - BATtseqbase(b1, b2->tseqbase); - } else if (b1->ttype != TYPE_void) { - /* b2 is not dense, so set b1 not dense */ - b1->tdense = FALSE; - BATtseqbase(b1, oid_nil); - b1->tnonil = b2->tnonil; - } else if (BATtkey(b2)) - BATtseqbase(b1, 0); - BATkey(b1, BATtkey(b2)); - b1->tsorted = BATtordered(b2); - b1->trevsorted = BATtrevordered(b2); - b1->batDirtydesc = TRUE; - b1->tnorevsorted = b2->tnorevsorted; - if (b2->tnokey[0] != b2->tnokey[1]) { - b1->tnokey[0] = b2->tnokey[0]; - b1->tnokey[1] = b2->tnokey[1]; - } else { - b1->tnokey[0] = b1->tnokey[1]; - } - b1->tnosorted = b2->tnosorted; -} - -/* - * The routines @emph{ALIGN_synced} and @emph{ALIGN_ordered} allow to - * simply query the alignment status of the two head columns of two - * BATs. - */ +/* Return TRUE if the two BATs are aligned (same size, same + * hseqbase). */ int ALIGNsynced(BAT *b1, BAT *b2) { - BATcheck(b1, "ALIGNsynced: bat 1 required", 0); - BATcheck(b2, "ALIGNsynced: bat 2 required", 0); + if (b1 == NULL || b2 == NULL) + return 0; assert(!is_oid_nil(b1->hseqbase)); assert(!is_oid_nil(b2->hseqbase)); @@ -127,12 +79,12 @@ ALIGNsynced(BAT *b1, BAT *b2) * need a modified version. */ BAT * -VIEWcreate_(oid seq, BAT *b, int slice_view) +VIEWcreate(oid seq, BAT *b) { BAT *bn; bat tp = 0; - BATcheck(b, "VIEWcreate_", NULL); + BATcheck(b, "VIEWcreate", NULL); bn = BATcreatedesc(seq, b->ttype, FALSE, TRANSIENT); if (bn == NULL) @@ -173,8 +125,7 @@ VIEWcreate_(oid seq, BAT *b, int slice_v /* Some bits must be copied individually. */ bn->batDirty = BATdirty(b); bn->batRestricted = BAT_READ; - /* slices are unequal to their parents; cannot use accs */ - if (slice_view || !tp || isVIEW(b)) + if (!tp || isVIEW(b)) bn->thash = NULL; else bn->thash = b->thash; @@ -193,12 +144,6 @@ VIEWcreate_(oid seq, BAT *b, int slice_v return bn; } -BAT * -VIEWcreate(oid seq, BAT *b) -{ - return VIEWcreate_(seq, b, FALSE); -} - /* * The BATmaterialize routine produces in-place materialized version * of a void bat (which should not be a VIEW) (later we should add the @@ -461,6 +406,9 @@ VIEWbounds(BAT *b, BAT *view, BUN l, BUN } else { view->tnokey[0] = view->tnokey[1] = 0; } + /* slices are unequal to their parents; cannot use accs */ + if (b->thash == view->thash) + view->thash = NULL; } /* diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -796,9 +796,34 @@ COLcopy(BAT *b, int tt, int writable, in BATsetcount(bn, cnt); } /* set properties (note that types may have changed in the copy) */ - ALIGNsetH(bn, b); + BAThseqbase(bn, b->hseqbase); if (ATOMtype(tt) == ATOMtype(b->ttype)) { - ALIGNsetT(bn, b); + if (BATtvoid(b)) { + /* b is either dense or has a void(nil) tail */ + if (bn->ttype != TYPE_void) + bn->tdense = TRUE; + else if (is_oid_nil(b->tseqbase)) + bn->tnonil = FALSE; + BATtseqbase(bn, b->tseqbase); + } else if (bn->ttype != TYPE_void) { + /* b is not dense, so set bn not dense */ + bn->tdense = FALSE; + BATtseqbase(bn, oid_nil); + bn->tnonil = b->tnonil; + } else if (BATtkey(b)) + BATtseqbase(bn, 0); + BATkey(bn, BATtkey(b)); + bn->tsorted = BATtordered(b); + bn->trevsorted = BATtrevordered(b); + bn->batDirtydesc = TRUE; + bn->tnorevsorted = b->tnorevsorted; + if (b->tnokey[0] != b->tnokey[1]) { + bn->tnokey[0] = b->tnokey[0]; + bn->tnokey[1] = b->tnokey[1]; + } else { + bn->tnokey[0] = bn->tnokey[1]; + } + bn->tnosorted = b->tnosorted; } else if (ATOMstorage(tt) == ATOMstorage(b->ttype) && ATOMcompare(tt) == ATOMcompare(b->ttype)) { BUN h = BUNlast(b); diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -925,7 +925,7 @@ BATslice(BAT *b, BUN l, BUN h) /* If the source BAT is readonly, then we can obtain a VIEW * that just reuses the memory of the source. */ if (BAThrestricted(b) == BAT_READ && BATtrestricted(b) == BAT_READ) { - bn = VIEWcreate_(b->hseqbase + low, b, TRUE); + bn = VIEWcreate(b->hseqbase + low, b); if (bn == NULL) return NULL; VIEWbounds(b, bn, l, h); diff --git a/monetdb5/modules/mal/iterator.c b/monetdb5/modules/mal/iterator.c --- a/monetdb5/modules/mal/iterator.c +++ b/monetdb5/modules/mal/iterator.c @@ -55,7 +55,11 @@ ITRnewChunk(lng *res, bat *vid, bat *bid throw(MAL, "chop.newChunk", INTERNAL_BAT_ACCESS); } cnt = BATcount(b); - view = VIEWcreate_(b->hseqbase, b, TRUE); + view = VIEWcreate(b->hseqbase, b); + if (view == NULL) { + BBPunfix(b->batCacheid); + throw(MAL, "chop.newChunk", GDK_EXCEPTION); + } /* printf("set bat chunk bound to " LLFMT " 0 - " BUNFMT "\n", *granule, MIN(cnt,(BUN) *granule)); */ diff --git a/sql/backends/monet5/sql_fround_impl.h b/sql/backends/monet5/sql_fround_impl.h --- a/sql/backends/monet5/sql_fround_impl.h +++ b/sql/backends/monet5/sql_fround_impl.h @@ -96,7 +96,7 @@ bat_dec_round_wrap(bat *_res, const bat /* set result BAT properties */ BATsetcount(res, cnt); /* result head is aligned with argument head */ - ALIGNsetH(res, v); + BAThseqbase(res, v->hseqbase); /* hard to predict correct tail properties in general */ res->tnonil = nonil; res->tnil = !nonil; @@ -208,7 +208,7 @@ bat_round_wrap(bat *_res, const bat *_v, /* set result BAT properties */ BATsetcount(res, cnt); /* result head is aligned with argument head */ - ALIGNsetH(res, v); + BAThseqbase(res, v->hseqbase); /* hard to predict correct tail properties in general */ res->tnonil = nonil; res->tnil = !nonil; diff --git a/sql/backends/monet5/sql_round_impl.h b/sql/backends/monet5/sql_round_impl.h --- a/sql/backends/monet5/sql_round_impl.h +++ b/sql/backends/monet5/sql_round_impl.h @@ -109,7 +109,7 @@ bat_dec_round_wrap(bat *_res, const bat /* set result BAT properties */ BATsetcount(res, cnt); /* result head is aligned with argument head */ - ALIGNsetH(res, v); + BAThseqbase(res, v->hseqbase); /* hard to predict correct tail properties in general */ res->tnonil = nonil; res->tnil = !nonil; @@ -238,7 +238,7 @@ bat_round_wrap(bat *_res, const bat *_v, /* set result BAT properties */ BATsetcount(res, cnt); /* result head is aligned with argument head */ - ALIGNsetH(res, v); + BAThseqbase(res, v->hseqbase); /* hard to predict correct tail properties in general */ res->tnonil = nonil; res->tnil = !nonil; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list