Changeset: 65b8d96802cc for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65b8d96802cc Modified Files: monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/algebra.mal Branch: default Log Message:
Upgrade the old-style interface to headless diffs (190 lines): diff --git a/monetdb5/modules/kernel/algebra.c b/monetdb5/modules/kernel/algebra.c --- a/monetdb5/modules/kernel/algebra.c +++ b/monetdb5/modules/kernel/algebra.c @@ -472,28 +472,6 @@ ALGselect1(int *result, int *bid, ptr va } str -ALGselect1Head(int *result, int *bid, ptr value) -{ - BAT *b, *bn = NULL; - - if ((b = BATdescriptor(*bid)) == NULL) { - throw(MAL, "algebra.select", RUNTIME_OBJECT_MISSING); - } - b = BATmirror(b); - derefStr(b, t, value); - bn = BATselect(b, value, 0); - bn = BATmirror(bn); - BBPreleaseref(b->batCacheid); - if (bn) { - if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ); - *result = bn->batCacheid; - BBPkeepref(*result); - return MAL_SUCCEED; - } - throw(MAL, "algebra.select", GDK_EXCEPTION); -} - -str ALGuselect1(int *result, int *bid, ptr value) { BAT *b, *bn = NULL; @@ -629,30 +607,6 @@ ALGselectNotNil(int *result, int *bid) } str -ALGselectHead(int *result, int *bid, ptr low, ptr high) -{ - BAT *b, *bn = NULL; - - if ((b = BATdescriptor(*bid)) == NULL) { - throw(MAL, "algebra.select", RUNTIME_OBJECT_MISSING); - } - b = BATmirror(b); - derefStr(b, t, low); - derefStr(b, t, high); - bn = BATselect(b, low, high); - bn = BATmirror(bn); - if (bn) { - if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ); - *result = bn->batCacheid; - BBPkeepref(*result); - BBPreleaseref(b->batCacheid); - return MAL_SUCCEED; - } - BBPreleaseref(b->batCacheid); - throw(MAL, "algebra.select", GDK_EXCEPTION); -} - -str ALGuselect(int *result, int *bid, ptr low, ptr high) { BAT *b, *bn = NULL; @@ -741,30 +695,6 @@ ALGselectInclusive(int *result, int *bid } str -ALGselectInclusiveHead(int *result, int *bid, ptr low, ptr high, bit *lin, bit *rin) -{ - BAT *b, *bn = NULL; - - if ((b = BATdescriptor(*bid)) == NULL) { - throw(MAL, "algebra.select", RUNTIME_OBJECT_MISSING); - } - b = BATmirror(b); - derefStr(b, t, low); - derefStr(b, t, high); - CMDselect_(&bn, b, low, high, lin, rin); - bn = BATmirror(bn); - if (bn) { - if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ); - *result = bn->batCacheid; - BBPkeepref(*result); - BBPreleaseref(b->batCacheid); - return MAL_SUCCEED; - } - BBPreleaseref(b->batCacheid); - throw(MAL, "algebra.select", GDK_EXCEPTION); -} - -str ALGuselectInclusive(int *result, int *bid, ptr low, ptr high, bit *lin, bit *rin) { BAT *b, *bn = NULL; diff --git a/monetdb5/modules/kernel/algebra.h b/monetdb5/modules/kernel/algebra.h --- a/monetdb5/modules/kernel/algebra.h +++ b/monetdb5/modules/kernel/algebra.h @@ -51,16 +51,13 @@ algebra_export str ALGsubselect2(bat *re algebra_export str ALGthetasubselect1(bat *result, bat *bid, const void *val, const char **op); algebra_export str ALGthetasubselect2(bat *result, bat *bid, bat *sid, const void *val, const char **op); algebra_export str ALGselect1(int *result, int *bid, ptr value); -algebra_export str ALGselect1Head(int *result, int *bid, ptr value); algebra_export str ALGuselect1(int *result, int *bid, ptr value); algebra_export str ALGthetauselect(int *result, int *bid, ptr value, str *op); algebra_export str ALGantiuselect1(int *result, int *bid, ptr value); algebra_export str ALGselect(int *result, int *bid, ptr low, ptr high); algebra_export str ALGthetaselect(int *result, int *bid, ptr low, str *op); -algebra_export str ALGselectHead(int *result, int *bid, ptr low, ptr high); algebra_export str ALGuselect(int *result, int *bid, ptr low, ptr high); algebra_export str ALGselectInclusive(int *result, int *bid, ptr low, ptr high, bit *lin, bit *rin); -algebra_export str ALGselectInclusiveHead(int *result, int *bid, ptr low, ptr high, bit *lin, bit *rin); algebra_export str ALGuselectInclusive(int *result, int *bid, ptr low, ptr high, bit *lin, bit *rin); algebra_export str ALGantiuselectInclusive(int *result, int *bid, ptr low, ptr high, bit *lin, bit *rin); diff --git a/monetdb5/modules/kernel/algebra.mal b/monetdb5/modules/kernel/algebra.mal --- a/monetdb5/modules/kernel/algebra.mal +++ b/monetdb5/modules/kernel/algebra.mal @@ -93,8 +93,12 @@ comment "Select all head values of the f the tail the head value of the input BAT for which the relationship holds. The output BAT is sorted on the tail value."; -command select(b:bat[:any_1,:any_2], low:any_2, high:any_2) - :bat[:any_1,:any_2] + +#command thetaselect(b:bat[:any_1,:any_2], val:any_2, op:str) :bat[:any_1,:any_2] +#address ALGthetaselect +#comment "The theta (<=,<,=,>,>=) select()"; +# +command select(b:bat[:oid,:any_2], low:any_2, high:any_2):bat[:oid,:any_2] address ALGselect comment "Select all BUNs that have tail values: {v| low <= v <= high}. NIL boundary values have a special meaning. @@ -106,12 +110,7 @@ comment "Select all BUNs that have tail ordered domain of values, tuples with 'nil' values are NEVER returned by the range select."; -command thetaselect(b:bat[:any_1,:any_2], val:any_2, op:str) :bat[:any_1,:any_2] -address ALGthetaselect -comment "The theta (<=,<,=,>,>=) select()"; - -command select(b:bat[:any_1,:any_2], low:any_2, - high:any_2, li:bit, hi:bit) :bat[:any_1,:any_2] +command select(b:bat[:oid,:any_2], low:any_2, high:any_2, li:bit, hi:bit) :bat[:oid,:any_2] address ALGselectInclusive comment "Select all BUNs that have tail values: {v| low <{=} v <{=} high}. Boundary inclusion is indicated separately. @@ -119,41 +118,17 @@ comment "Select all BUNs that have tail + low == nil means: no lower bound + high == nil means: no upper bound."; -command select(b:bat[:any_1,:any_2],value:any_2) :bat[:any_1,:any_2] +command select(b:bat[:oid,:any_2],value:any_2) :bat[:oid,:any_2] address ALGselect1 comment "Select all BUNs of a BAT with a certain tail value. Selection on NIL is also possible (it should be properly casted, e.g.:int(nil))."; -command selectNotNil(b:bat[:any_1,:any_2]):bat[:any_1,:any_2] +command selectNotNil(b:bat[:oid,:any_2]):bat[:oid,:any_2] address ALGselectNotNil comment "Select all not-nil values"; -# The second group uses the head to perform the range selection. -command selectH(b:bat[:any_1,:any_2], low:any_1, high:any_1) - :bat[:any_1,:any_2] -address ALGselectHead; - -command selectH(b:bat[:any_1,:any_2], low:any_1, - high:any_1, li:bit, hi:bit) :bat[:any_1,:any_2] -address ALGselectInclusiveHead; - -command selectH(b:bat[:any_1,:any_2],value:any_1) :bat[:any_1,:any_2] -address ALGselect1Head; - -# A special case for this set are the void tailed bats. -command select(b:bat[:any_2,:void], low:any_2) - :bat[:any_2,:void] -address ALGselect1Head; - -command select(b:bat[:any_2,:void], low:any_2, high:any_2) - :bat[:any_2,:void] -address ALGselectHead; -command select(b:bat[:any_2,:void], low:any_2, high:any_2,li:bit, hi:bit) - :bat[:any_2,:void] -address ALGselectInclusiveHead; - # The second group uses the head to perform the range selection command slice(b:bat[:any_1,:any_2], x:oid, y:oid) :bat[:any_1,:any_2] _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list