Changeset: 5329f3501aef for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5329f3501aef
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/exports.stable.out
monetdb5/modules/kernel/algebra.c
monetdb5/modules/kernel/algebra.h
monetdb5/modules/kernel/algebra.mal
monetdb5/optimizer/Tests/CXerror1.mal
monetdb5/optimizer/Tests/CXerror1.stable.out
Branch: default
Log Message:
Exists() moved to void-headed
diffs (143 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
@@ -2396,13 +2396,9 @@ comment Returns physical copy of a BAT.
command
algebra.difference(left:bat[:any_1,:any_2],right:bat[:any_1,:any_2]):bat[:any_1,:any_2]
address ALGsdiff;
-command algebra.exist(b:bat[:any_1,:any_2],h:any_1,t:any_2):bit
-address ALGexistBUN;
-comment Returns true when 'h,t' occurs as a bun in b.
-
-command algebra.exist(b:bat[:any_1,:any_2],h:any_1):bit
+command algebra.exist(b:bat[:oid,:any_1],val:any_1):bit
address ALGexist;
-comment Returns whether 'h' occurs as a head value in b.
+comment Returns whether 'val' occurs in b.
command algebra.fetch(b:bat[:any_2,:any_1],x:int):any_1
address ALGfetchint;
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
@@ -746,7 +746,6 @@ str ALGcount_no_nil(wrd *result, int *bi
str ALGcross(int *result, int *lid, int *rid);
str ALGcrossproduct2(int *l, int *r, int *lid, int *rid);
str ALGexist(bit *ret, int *bid, ptr val);
-str ALGexistBUN(bit *ret, int *bid, ptr val, ptr tval);
str ALGfetch(ptr ret, int *bid, lng *pos);
str ALGfetchint(int *ret, int *bid, int *pos);
str ALGfetchoid(int *ret, int *bid, oid *pos);
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
@@ -279,22 +279,6 @@ CMDpositionBUN(wrd *retval, BAT *b, ptr
return GDK_SUCCEED;
}
-static int
-CMDexist(bit *ret, BAT *b, ptr val)
-{
- BUN q = BUNfnd(b, val);
-
- *ret = (q != BUN_NONE) ? 1 : 0;
- return GDK_SUCCEED;
-}
-static int
-CMDexistBUN(bit *ret, BAT *b, ptr val, ptr tval)
-{
- BUN q = BUNlocate(b, val, tval);
-
- *ret = (q != BUN_NONE) ? 1 : 0;
- return GDK_SUCCEED;
-}
/*
* @- Wrapper
@@ -2277,27 +2261,14 @@ str
ALGexist(bit *ret, int *bid, ptr val)
{
BAT *b;
+ BUN q;
if ((b = BATdescriptor(*bid)) == NULL) {
throw(MAL, "algebra.exist", RUNTIME_OBJECT_MISSING);
}
derefStr(b, h, val);
- CMDexist(ret, b, val);
- BBPreleaseref(b->batCacheid);
- return MAL_SUCCEED;
-}
-
-str
-ALGexistBUN(bit *ret, int *bid, ptr val, ptr tval)
-{
- BAT *b;
-
- if ((b = BATdescriptor(*bid)) == NULL) {
- throw(MAL, "algebra.exist", RUNTIME_OBJECT_MISSING);
- }
- derefStr(b, h, val);
- derefStr(b, t, tval);
- CMDexistBUN(ret, b, val, tval);
+ q = BUNfnd(BATmirror(b), val);
+ *ret = (q != BUN_NONE) ? 1 : 0;
BBPreleaseref(b->batCacheid);
return MAL_SUCCEED;
}
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
@@ -150,7 +150,6 @@ algebra_export str ALGfetch(ptr ret, int
algebra_export str ALGfetchoid(int *ret, int *bid, oid *pos);
algebra_export str ALGfetchint(int *ret, int *bid, int *pos);
algebra_export str ALGexist(bit *ret, int *bid, ptr val);
-algebra_export str ALGexistBUN(bit *ret, int *bid, ptr val, ptr tval);
algebra_export str ALGfind(ptr ret, int *bid, ptr val);
algebra_export str ALGindexjoin(int *result, int *lid, int *rid);
algebra_export str ALGprojectNIL(int *ret, int *bid);
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
@@ -21,13 +21,9 @@
# @+ Value Selections
module algebra;
-command exist(b:bat[:any_1,:any_2], h:any_1):bit
+command exist(b:bat[:oid,:any_1], val:any_1):bit
address ALGexist
-comment "Returns whether 'h' occurs as a head value in b.";
-
-command exist(b:bat[:any_1,:any_2], h:any_1, t:any_2):bit
-address ALGexistBUN
-comment "Returns true when 'h,t' occurs as a bun in b.";
+comment "Returns whether 'val' occurs in b.";
command find(b:bat[:any_1,:any_2], h:any_1):any_2
address ALGfind
diff --git a/monetdb5/optimizer/Tests/CXerror1.mal
b/monetdb5/optimizer/Tests/CXerror1.mal
--- a/monetdb5/optimizer/Tests/CXerror1.mal
+++ b/monetdb5/optimizer/Tests/CXerror1.mal
@@ -8,8 +8,7 @@ function user.f1();
# check existance
xxx_1 := bbp.getNames();
- xr:= bat.reverse(xxx_1);
- xxx_3 := algebra.exist(xr,"xxx");
+ xxx_3 := algebra.exist(xxx_1,"xxx");
# if it exists, print it
barrier ifb := xxx_3;
diff --git a/monetdb5/optimizer/Tests/CXerror1.stable.out
b/monetdb5/optimizer/Tests/CXerror1.stable.out
--- a/monetdb5/optimizer/Tests/CXerror1.stable.out
+++ b/monetdb5/optimizer/Tests/CXerror1.stable.out
@@ -25,8 +25,7 @@ function user.f1():void;
transaction.commit();
# check existance
xxx_1 := bbp.getNames();
- xr := bat.reverse(xxx_1);
- xxx_3 := algebra.exist(xr,"xxx");
+ xxx_3 := algebra.exist(xxx_1,"xxx");
# if it exists, print it
barrier ifb := xxx_3;
a := bbp.bind("xxx");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list