Changeset: 9123983d104c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9123983d104c Modified Files: gdk/gdk_calc.c monetdb5/modules/mal/batcalc.c Branch: default Log Message:
gdk_calc functions now demand dense-headed bats. The conversion between non-dense and dense now happens in the interface functions in batcalc.c. diffs (truncated from 1526 to 300 lines): diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c --- a/gdk/gdk_calc.c +++ b/gdk/gdk_calc.c @@ -32,9 +32,8 @@ static int checkbats(BAT *b1, BAT *b2, const char *func) { - if ((b1->H->type != TYPE_void && b1->H->type != TYPE_oid) || - (b2 != NULL && b2->H->type != TYPE_void && b2->H->type != TYPE_oid)) { - GDKerror("%s: inputs must have (V)OID head.\n", func); + if (!BAThdense(b1) || (b2 != NULL && !BAThdense(b2))) { + GDKerror("%s: inputs must have dense head.\n", func); return GDK_FAIL; } if (b2 != NULL) { @@ -165,12 +164,6 @@ BATcalcnot(BAT *b) b->P->descdirty = 1; } - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -282,12 +275,6 @@ BATcalcnegate(BAT *b) b->P->descdirty = 1; } - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -411,12 +398,6 @@ BATcalcabsolute(BAT *b) b->P->descdirty = 1; } - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -533,12 +514,6 @@ BATcalciszero(BAT *b) b->P->descdirty = 1; } - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -659,12 +634,6 @@ BATcalcsign(BAT *b) b->P->descdirty = 1; } - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -809,12 +778,6 @@ BATcalcisnil(BAT *b) bn->T->nonil = 1; bn->T->key = bn->U->count <= 1; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -1760,12 +1723,6 @@ BATcalcadd(BAT *b1, BAT *b2, int tp, int bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b1->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b1, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -1808,12 +1765,6 @@ BATcalcaddcst(BAT *b, const ValRecord *v bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -1856,12 +1807,6 @@ BATcalccstadd(const ValRecord *v, BAT *b bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -1924,12 +1869,6 @@ BATcalcincr(BAT *b, int abort_on_error) b->P->descdirty = 1; } - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -2867,12 +2806,6 @@ BATcalcsub(BAT *b1, BAT *b2, int tp, int bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b1->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b1, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -2915,12 +2848,6 @@ BATcalcsubcst(BAT *b, const ValRecord *v bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -2964,12 +2891,6 @@ BATcalccstsub(const ValRecord *v, BAT *b bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -3032,12 +2953,6 @@ BATcalcdecr(BAT *b, int abort_on_error) b->P->descdirty = 1; } - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -4056,12 +3971,6 @@ BATcalcmul(BAT *b1, BAT *b2, int tp, int bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b1->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b1, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -4114,12 +4023,6 @@ BATcalcmulcst(BAT *b, const ValRecord *v bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -4172,12 +4075,6 @@ BATcalccstmul(const ValRecord *v, BAT *b bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -5212,12 +5109,6 @@ BATcalcdiv(BAT *b1, BAT *b2, int tp, int bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b1->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b1, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -5273,12 +5164,6 @@ BATcalcdivcst(BAT *b, const ValRecord *v bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -5316,12 +5201,6 @@ BATcalccstdiv(const ValRecord *v, BAT *b bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -6184,12 +6063,6 @@ BATcalcmod(BAT *b1, BAT *b2, int tp, int bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b1->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b1, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } @@ -6227,12 +6100,6 @@ BATcalcmodcst(BAT *b, const ValRecord *v bn->T->nil = nils != 0; bn->T->nonil = nils == 0; - if (b->H->type != bn->H->type) { - BAT *bnn = VIEWcreate(b, bn); - BBPunfix(bn->batCacheid); - bn = bnn; - } - return bn; } _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list