Re: [Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/kernel algebra.mx, MonetDB_5-6, 1.196, 1.196.2.1
When propagating I noticed this. This change, and the accompanying change in SQL, is not allowed on the stable branch. With this change, a new SQL cannot work with an old MonetDB5 and that makes this change unacceptable. If you want to fix a bug than you will just have to work around it on the SQL side without adding new features in MonetDB5. Your release manager. Sorry Niels. Niels Nes wrote:
Update of /cvsroot/monetdb/MonetDB5/src/modules/kernel In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28287/src/modules/kernel
Modified Files: Tag: MonetDB_5-6 algebra.mx Log Message: added thetauselect/thetaselect these correctly handle nil cases (the sql semantics way)
U algebra.mx Index: algebra.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/kernel/algebra.mx,v retrieving revision 1.196 retrieving revision 1.196.2.1 diff -u -d -r1.196 -r1.196.2.1 --- algebra.mx 24 Apr 2008 20:28:13 -0000 1.196 +++ algebra.mx 30 Aug 2008 06:50:36 -0000 1.196.2.1 @@ -111,6 +111,10 @@ 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] address ALGselectInclusive @@ -149,6 +153,7 @@ 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; @@ -186,6 +191,10 @@ address ALGuselectInclusive comment "See select() but limited to head values";
+command thetauselect(b:bat[:any_1,:any_2], val:any_2, op:str) :bat[:any_1,:oid] +address ALGthetauselect +comment "The theta (<=,<,=,>,>=) select() limited to head values"; + command uselect(b:bat[:any_1,:any_2], low:any_2, high:any_2):bat[:any_1,:oid] address ALGuselect; command uselect(b:bat[:any_1,:any_2], value:any_2) :bat[:any_1,:oid] @@ -942,8 +951,10 @@ 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); @@ -2495,6 +2506,49 @@ }
str +ALGthetaselect(int *result, int *bid, ptr val, str *OP) +{ + ptr nilptr; + BAT *b, *bn = NULL; + + if ((b = BATdescriptor(*bid)) == NULL) { + throw(MAL, "algebra.thetaselect", "Cannot access descriptor"); + } + nilptr = ATOMnilptr(b->ttype); + @:derefStr(b,t,val);@ + if (ATOMcmp(b->ttype, val, nilptr) == 0) { + bn = BATnew(b->htype,b->ttype, 0); + } else { + char *op = *OP; + bit lin = TRUE, rin = TRUE; + ptr low = nilptr, high = nilptr; + + if (op[0] == '=') { + low = val; + high = NULL; + } else if (op[0] == '<') { + high = val; + rin = (op[1] == '='); + } else if (op[0] == '>') { + low = val; + lin = (op[1] == '='); + } else { + BBPreleaseref(b->batCacheid); + throw(MAL, "algebra.thetaselect", "unknown operator"); + } + CMDselect_(&bn, b, low, high, &lin, &rin); + } + 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.thetaselect", "GDKerror"); +} + +str ALGselectNotNil(int *result, int *bid) { BAT *b, *bn = NULL; @@ -2567,6 +2621,49 @@ }
str +ALGthetauselect(int *result, int *bid, ptr val, str *OP) +{ + ptr nilptr; + BAT *b, *bn = NULL; + + if ((b = BATdescriptor(*bid)) == NULL) { + throw(MAL, "algebra.thetauselect", "Cannot access descriptor"); + } + nilptr = ATOMnilptr(b->ttype); + @:derefStr(b,t,val);@ + if (ATOMcmp(b->ttype, val, nilptr) == 0) { + bn = BATnew(b->htype,TYPE_void, 0); + } else { + char *op = *OP; + bit lin = TRUE, rin = TRUE; + ptr low = nilptr, high = nilptr; + + if (op[0] == '=') { + low = val; + high = NULL; + } else if (op[0] == '<') { + high = val; + rin = (op[1] == '='); + } else if (op[0] == '>') { + low = val; + lin = (op[1] == '='); + } else { + BBPreleaseref(b->batCacheid); + throw(MAL, "algebra.thetauselect", "unknown operator"); + } + CMDuselect_(&bn, b, low, high, &lin, &rin); + } + 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.thetauselect", "GDKerror"); +} + +str ALGselectInclusive(int *result, int *bid, ptr low, ptr high, bit *lin, bit *rin) { BAT *b, *bn = NULL; @@ -3776,12 +3873,9 @@ if( ATOMvarsized(b->ttype) || b->htype != TYPE_void){ bn= BATwcopy(b); } else { - bn= BATnew(b->htype,b->ttype,BATcount(b)); - bn->H->heap.free = headsize(bn,BATcount(b)); - bn->T->heap.free = tailsize(bn,BATcount(b)); + bn = BATnew(b->htype,b->ttype,BATcount(b)); BATsetcount(bn,BATcount(b)); - - bn->tsorted= FALSE; + bn->tsorted = FALSE; BATkey(bn,FALSE); /* head is void */ BATseqbase(bn, b->hseqbase);
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
-- Sjoerd Mullender
participants (1)
-
Sjoerd Mullender