Changeset: fa207b6621cb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fa207b6621cb
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
sql/backends/monet5/sql.c
sql/backends/monet5/sql.h
sql/backends/monet5/sql.mal
Branch: default
Log Message:
removed unused not_unique_oids function
diffs (173 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
@@ -40640,12 +40640,6 @@ pattern sql.mvc():int
address SQLmvc;
comment Get the multiversion catalog context. Needed for correct statement
dependencies(ie sql.update, should be after sql.bind in concurrent execution)
-command sql.not_uniques(b:bat[:oid,:wrd]):bat[:oid,:oid]
-address not_unique_oids;
-command sql.not_uniques(b:bat[:oid,:oid]):bat[:oid,:oid]
-address not_unique_oids;
-comment return not unique oids
-
command sql.not_unique(b:bat[:oid,:oid]):bit
address not_unique;
comment check if the tail sorted bat b doesn't have unique tail values
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
@@ -51575,12 +51575,6 @@ pattern sql.mvc():int
address SQLmvc;
comment Get the multiversion catalog context. Needed for correct statement
dependencies(ie sql.update, should be after sql.bind in concurrent execution)
-command sql.not_uniques(b:bat[:oid,:wrd]):bat[:oid,:oid]
-address not_unique_oids;
-command sql.not_uniques(b:bat[:oid,:oid]):bat[:oid,:oid]
-address not_unique_oids;
-comment return not unique oids
-
command sql.not_unique(b:bat[:oid,:oid]):bit
address not_unique;
comment check if the tail sorted bat b doesn't have unique tail values
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -3594,109 +3594,6 @@ not_unique(bit *ret, const bat *bid)
return MAL_SUCCEED;
}
-/* later we could optimize this to start from current BUN
- And only search the from the first if second is not found.
- */
-static inline int
-HASHfndTwice(BAT *b, ptr v)
-{
- BATiter bi = bat_iterator(b);
- BUN i = BUN_NONE;
- int first = 1;
-
- HASHloop(bi, b->T->hash, i, v) {
- if (!first)
- return 1;
- first = 0;
- }
- return 0;
-}
-
-str
-not_unique_oids(bat *ret, const bat *bid)
-{
- BAT *b, *bn = NULL;
-
- if ((b = BATdescriptor(*bid)) == NULL) {
- throw(SQL, "not_uniques", "Cannot access descriptor");
- }
- if (b->ttype != TYPE_oid && b->ttype != TYPE_wrd) {
- throw(SQL, "not_uniques", "Wrong types");
- }
-
- assert(b->htype == TYPE_oid);
- if (BATtkey(b) || BATtdense(b) || BATcount(b) <= 1) {
- bn = BATnew(TYPE_void, TYPE_void, 0, TRANSIENT);
- if (bn == NULL) {
- BBPunfix(b->batCacheid);
- throw(SQL, "sql.not_uniques", MAL_MALLOC_FAIL);
- }
- BATseqbase(bn, 0);
- BATseqbase(BATmirror(bn), 0);
- } else if (b->tsorted) { /* ugh handle both wrd and oid types */
- oid c = *(oid *) Tloc(b, BUNfirst(b)), *rf, *rh, *rt;
- oid *h = (oid *) Hloc(b, 0), *vp, *ve;
- int first = 1;
-
- bn = BATnew(TYPE_oid, TYPE_oid, BATcount(b), TRANSIENT);
- if (bn == NULL) {
- BBPunfix(b->batCacheid);
- throw(SQL, "sql.not_uniques", MAL_MALLOC_FAIL);
- }
- vp = (oid *) Tloc(b, BUNfirst(b));
- ve = vp + BATcount(b);
- rf = rh = (oid *) Hloc(bn, BUNfirst(bn));
- rt = (oid *) Tloc(bn, BUNfirst(bn));
- *rh++ = *h++;
- *rt++ = *vp;
- for (vp++; vp < ve; vp++, h++) {
- oid v = *vp;
- if (v == c) {
- first = 0;
- *rh++ = *h;
- *rt++ = v;
- } else if (!first) {
- first = 1;
- *rh++ = *h;
- *rt++ = v;
- } else {
- *rh = *h;
- *rt = v;
- }
- c = v;
- }
- if (first)
- rh--;
- BATsetcount(bn, (BUN) (rh - rf));
- } else {
- oid *rf, *rh, *rt;
- oid *h = (oid *) Hloc(b, 0), *vp, *ve;
-
- if (BAThash(b, 0) != GDK_SUCCEED)
- throw(SQL, "not_uniques", "hash creation failed");
- bn = BATnew(TYPE_oid, TYPE_oid, BATcount(b), TRANSIENT);
- if (bn == NULL) {
- BBPunfix(b->batCacheid);
- throw(SQL, "sql.unique_oids", MAL_MALLOC_FAIL);
- }
- vp = (oid *) Tloc(b, BUNfirst(b));
- ve = vp + BATcount(b);
- rf = rh = (oid *) Hloc(bn, BUNfirst(bn));
- rt = (oid *) Tloc(bn, BUNfirst(bn));
- for (; vp < ve; vp++, h++) {
- /* try to find value twice */
- if (HASHfndTwice(b, vp)) {
- *rh++ = *h;
- *rt++ = *vp;
- }
- }
- BATsetcount(bn, (BUN) (rh - rf));
- }
- BBPunfix(b->batCacheid);
- BBPkeepref(*ret = bn->batCacheid);
- return MAL_SUCCEED;
-}
-
/* row case */
str
SQLidentity(oid *ret, const void *i)
diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h
--- a/sql/backends/monet5/sql.h
+++ b/sql/backends/monet5/sql.h
@@ -125,7 +125,6 @@ sql5_export str mvc_getVersion(lng *r, c
sql5_export str mvc_restart_seq(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
sql5_export str zero_or_one(ptr ret, const bat *bid);
sql5_export str not_unique(bit *ret, const bat *bid);
-sql5_export str not_unique_oids(bat *ret, const bat *bid);
sql5_export str SQLshrink(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
sql5_export str SQLreuse(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
sql5_export str SQLvacuum(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -395,13 +395,6 @@ command not_unique( b:bat[:oid,:oid]) :b
address not_unique
comment "check if the tail sorted bat b doesn't have unique tail values" ;
-command not_uniques( b:bat[:oid,:oid]) :bat[:oid,:oid]
-address not_unique_oids
-comment "return not unique oids" ;
-
-command not_uniques( b:bat[:oid,:wrd]) :bat[:oid,:oid]
-address not_unique_oids ;
-
command optimizers()(:bat[:oid,:str],:bat[:oid,:str],:bat[:oid,:str])
address getPipeCatalog;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list