Changeset: 8c736deba24c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c736deba24c Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out monetdb5/ChangeLog monetdb5/mal/Tests/tst201.mal monetdb5/mal/Tests/tst201.stable.out monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/algebra.mal Branch: default Log Message:
Removed algebra.like with a BAT argument. diffs (239 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -2350,10 +2350,6 @@ command algebra.like(s:str,pat:str):bit address PCRElike2; command algebra.like(s:str,pat:str,esc:str):bit address PCRElike3; -command algebra.like(b:bat[:oid,:str],substr:str):bat[:oid,:oid] -address ALGlike; -comment Selects all elements that have 'substr' as in the tail. - command algebra.leftfetchjoin(left:bat[:oid,:oid],right:bat[:oid,:any_3]):bat[:oid,:any_3] address ALGleftfetchjoin; comment Hook directly into the left fetch join implementation. diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -2861,10 +2861,6 @@ command algebra.like(s:str,pat:str):bit address PCRElike2; command algebra.like(s:str,pat:str,esc:str):bit address PCRElike3; -command algebra.like(b:bat[:oid,:str],substr:str):bat[:oid,:oid] -address ALGlike; -comment Selects all elements that have 'substr' as in the tail. - command algebra.leftfetchjoin(left:bat[:oid,:oid],right:bat[:oid,:any_3]):bat[:oid,:any_3] address ALGleftfetchjoin; comment Hook directly into the left fetch join implementation. 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 @@ -710,7 +710,6 @@ str ALGgroupby(bat *res, const bat *gids str ALGjoin2(bat *l, bat *r, const bat *lid, const bat *rid); str ALGjoinPath(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str ALGleftfetchjoin(bat *result, const bat *lid, const bat *rid); -str ALGlike(bat *ret, const bat *bid, const str *k); str ALGmaxany(ptr result, const bat *bid); str ALGminany(ptr result, const bat *bid); str ALGprojecttail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); diff --git a/monetdb5/ChangeLog b/monetdb5/ChangeLog --- a/monetdb5/ChangeLog +++ b/monetdb5/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog file for MonetDB5 # This file is updated with Maddlog +* Wed Oct 7 2015 Sjoerd Mullender <[email protected]> +- Removed algerbra.like with a BAT argument. Use algebra.likesubselect + instead. + * Wed Sep 16 2015 Sjoerd Mullender <[email protected]> - Removed algebra.leftjoin. Use algebra.subleftjoin or algebra.leftfetchjoin instead. diff --git a/monetdb5/mal/Tests/tst201.mal b/monetdb5/mal/Tests/tst201.mal --- a/monetdb5/mal/Tests/tst201.mal +++ b/monetdb5/mal/Tests/tst201.mal @@ -63,14 +63,14 @@ exit MALException; v45:= algebra.slice(b,v43,v44); v46:= io.print(v45); - v75:= algebra.like(b,"ox"); + v75:= algebra.likesubselect(b, nil:bat, "ox", nil:str, false, false); v76:= io.print(v75); - v78:= algebra.like(b,"fo"); + v78:= algebra.likesubselect(b, nil:bat, "fo", nil:str, false, false); v79:= io.print(v78); - v81:= algebra.like(b,"fox"); + v81:= algebra.likesubselect(b, nil:bat, "fox", nil:str, false, false); v82:= io.print(v81); - v84:= algebra.like(b," fox"); + v84:= algebra.likesubselect(b, nil:bat, " fox", nil:str, false, false); v85:= io.print(v84); diff --git a/monetdb5/mal/Tests/tst201.stable.out b/monetdb5/mal/Tests/tst201.stable.out --- a/monetdb5/mal/Tests/tst201.stable.out +++ b/monetdb5/mal/Tests/tst201.stable.out @@ -54,13 +54,13 @@ exit MALException:str; v44 := calc.oid(nil); v45 := algebra.slice(b,v43,v44); v46 := io.print(v45); - v75 := algebra.like(b,"ox"); + v75 := algebra.likesubselect(b,nil:BAT,"ox",nil:str,false,false); v76 := io.print(v75); - v78 := algebra.like(b,"fo"); + v78 := algebra.likesubselect(b,nil:BAT,"fo",nil:str,false,false); v79 := io.print(v78); - v81 := algebra.like(b,"fox"); + v81 := algebra.likesubselect(b,nil:BAT,"fox",nil:str,false,false); v82 := io.print(v81); - v84 := algebra.like(b," fox"); + v84 := algebra.likesubselect(b,nil:BAT," fox",nil:str,false,false); v85 := io.print(v84); end user.main; #--------------------------# @@ -133,17 +133,15 @@ end user.main; # t t # name # void str # type #--------------------------# -[ nil, 9@0 ] #--------------------------# # h t # name # oid str # type #--------------------------# -[ nil, 9@0 ] #--------------------------# # h t # name # oid str # type #--------------------------# -[ nil, 9@0 ] +[ 0@0, 9@0 ] #--------------------------# # h t # name # oid str # type 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 @@ -101,67 +101,6 @@ CMDgen_group(BAT **result, BAT *gids, BA } -/* - * The string pattern matching routine has been added. It should be - * dynamically linked. - * A simple string matcher is included. It should be refined later on - */ -static inline int -like(const char *x, const char *y, BUN ylen) -{ - const char *r; - - if (x == (char *) NULL) { - return 0; - } - for (r = x + strlen(x) - ylen; x <= r; x++) { - int ok = 1; - const char *s = x; - const char *q; - - for (q = y; *q; q++, s++) - if (*q != tolower(*s)) { - ok = 0; - break; - } - if (ok) - return 1; - } - return 0; -} - -static gdk_return -CMDlike(BAT **ret, BAT *b, const char *s) -{ - BATiter bi = bat_iterator(b); - BAT *c = BATnew(TYPE_void, TYPE_oid, BATcount(b) / 10, TRANSIENT); - str t, p; - BUN u, v; - BUN yy = 0; - - if (c == NULL) - return GDK_FAIL; - t = GDKstrdup(s); - for (p = t; *p; p++, yy++) - *p = tolower(*p); - - BATloop(b, u, v) { - p = BUNtvar(bi, u); - if (like(p, t, yy) && - BUNappend(c, &u, TRUE) != GDK_SUCCEED) { - BBPreclaim(c); - GDKfree(t); - return GDK_FAIL; - } - } - c->tsorted = BATtordered(b); - c->trevsorted = BATtrevordered(b); - c->T->nonil = b->T->nonil; - *ret = c; - GDKfree(t); - return GDK_SUCCEED; -} - static gdk_return slice(BAT **retval, BAT *b, lng start, lng end) { @@ -1027,26 +966,6 @@ ALGtmarkp(bat *result, const bat *bid, c } str -ALGlike(bat *ret, const bat *bid, const str *k) -{ - BAT *b, *bn = NULL; - - if ((b = BATdescriptor(*bid)) == NULL) { - throw(MAL, "algebra.like", RUNTIME_OBJECT_MISSING); - } - CMDlike(&bn, b, *k); - if (bn) { - if (!(bn->batDirty&2)) BATsetaccess(bn, BAT_READ); - *ret = bn->batCacheid; - BBPkeepref(*ret); - BBPunfix(b->batCacheid); - return MAL_SUCCEED; - } - BBPunfix(b->batCacheid); - throw(MAL, "algebra.like", GDK_EXCEPTION); -} - -str ALGslice(bat *ret, const bat *bid, const lng *start, const lng *end) { 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 @@ -79,7 +79,6 @@ algebra_export str ALGcount_no_nil(wrd * algebra_export str ALGtmark(bat *result, const bat *bid, const oid *base); algebra_export str ALGtmark_default(bat *result, const bat *bid); algebra_export str ALGtmarkp(bat *result, const bat *bid, const int *nr_parts, const int *part_nr); -algebra_export str ALGlike(bat *ret, const bat *bid, const str *k); algebra_export str ALGslice(bat *ret, const bat *bid, const lng *start, const lng *end); algebra_export str ALGslice_int(bat *ret, const bat *bid, const int *start, const int *end); algebra_export str ALGslice_wrd(bat *ret, const bat *bid, const wrd *start, const wrd *end); 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 @@ -92,11 +92,6 @@ command selectNotNil(b:bat[:oid,:any_2]) address ALGselectNotNil comment "Select all not-nil values"; -# Pattern matching -command like(b:bat[:oid,:str], substr:str) :bat[:oid,:oid] -address ALGlike -comment "Selects all elements that have 'substr' as in the tail."; - command subsort(b:bat[:oid,:any_1], reverse:bit, stable:bit) :bat[:oid,:any_1] address ALGsubsort11 comment "Returns a copy of the BAT sorted on tail values. _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
