Changeset: 9097e3be6c63 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9097e3be6c63
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        gdk/ChangeLog
        gdk/gdk.h
        gdk/gdk_align.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        monetdb5/ChangeLog
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/kernel/bat5.h
        monetdb5/modules/kernel/bat5.mal
        monetdb5/modules/mal/Tests/inspect05.stable.out
        monetdb5/modules/mal/Tests/inspect05.stable.out.int128
        sql/backends/monet5/sql_statement.c
Branch: default
Log Message:

Removed the tunique property since it wasn't used.


diffs (truncated from 449 to 300 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
@@ -681,7 +681,6 @@ stdout of test 'MAL-signatures` in direc
 [ "bat",       "setColumn",    "command bat.setColumn(b:bat[:any_1], 
t:str):void ",    "BKCsetColumn;",        "Give a logical name to the tail 
column of a BAT."      ]
 [ "bat",       "setHash",      "command bat.setHash(b:bat[:any_1]):bit ",      
"BKCsetHash;",  "Create a hash structure on the column" ]
 [ "bat",       "setImprints",  "command bat.setImprints(b:bat[:any_1]):bit ",  
"BKCsetImprints;",      "Create an imprints structure on the column"    ]
-[ "bat",       "setKey",       "command bat.setKey(b:bat[:any_1], 
mode:bit):bat[:any_1] ",     "BKCsetkey;",   "Sets the 'key' property of the 
tail column to 'mode'. In 'key' mode,\n        the kernel will silently block 
insertions that cause a duplicate\n        entry in the head column."     ]
 [ "bat",       "setName",      "command bat.setName(b:bat[:any_1], s:str):void 
",      "BKCsetName;",  "Give a logical name to a BAT. "        ]
 [ "bat",       "setPersistent",        "command 
bat.setPersistent(b:bat[:any_1]):void ",       "BKCsetPersistent;",    "Make 
the BAT persistent."      ]
 [ "bat",       "setTransient", "command bat.setTransient(b:bat[:any_1]):void 
",        "BKCsetTransient;",     "Make the BAT transient.  Returns \n\tboolean 
which indicates if the\nBAT administration has indeed changed."   ]
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
@@ -787,7 +787,6 @@ stdout of test 'MAL-signatures` in direc
 [ "bat",       "setColumn",    "command bat.setColumn(b:bat[:any_1], 
t:str):void ",    "BKCsetColumn;",        "Give a logical name to the tail 
column of a BAT."      ]
 [ "bat",       "setHash",      "command bat.setHash(b:bat[:any_1]):bit ",      
"BKCsetHash;",  "Create a hash structure on the column" ]
 [ "bat",       "setImprints",  "command bat.setImprints(b:bat[:any_1]):bit ",  
"BKCsetImprints;",      "Create an imprints structure on the column"    ]
-[ "bat",       "setKey",       "command bat.setKey(b:bat[:any_1], 
mode:bit):bat[:any_1] ",     "BKCsetkey;",   "Sets the 'key' property of the 
tail column to 'mode'. In 'key' mode,\n        the kernel will silently block 
insertions that cause a duplicate\n        entry in the head column."     ]
 [ "bat",       "setName",      "command bat.setName(b:bat[:any_1], s:str):void 
",      "BKCsetName;",  "Give a logical name to a BAT. "        ]
 [ "bat",       "setPersistent",        "command 
bat.setPersistent(b:bat[:any_1]):void ",       "BKCsetPersistent;",    "Make 
the BAT persistent."      ]
 [ "bat",       "setTransient", "command bat.setTransient(b:bat[:any_1]):void 
",        "BKCsetTransient;",     "Make the BAT transient.  Returns \n\tboolean 
which indicates if the\nBAT administration has indeed changed."   ]
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
@@ -856,7 +856,6 @@ str BKCsetImprints(bit *ret, const bat *
 str BKCsetName(void *r, const bat *bid, const char *const *s);
 str BKCsetPersistent(void *r, const bat *bid);
 str BKCsetTransient(void *r, const bat *bid);
-str BKCsetkey(bat *res, const bat *bid, const bit *param);
 str BKCshrinkBAT(bat *ret, const bat *bid, const bat *did);
 str BLOBblob_blob(blob **d, blob **s);
 str BLOBblob_fromstr(blob **b, const char **d);
diff --git a/gdk/ChangeLog b/gdk/ChangeLog
--- a/gdk/ChangeLog
+++ b/gdk/ChangeLog
@@ -1,6 +1,11 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Tue Dec  3 2019 Sjoerd Mullender <sjo...@acm.org>
+- Removed the tunique property.  The tunique property indicated that
+  all values in the column had to be distinct.  It was removed because
+  it wasn't used.
+
 * Fri Nov 22 2019 Sjoerd Mullender <sjo...@acm.org>
 - BATrangeselect now has two extra arguments: anti and symmetric
   (both bool).
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -716,7 +716,6 @@ gdk_export int VALisnil(const ValRecord 
  *           int    ttype;            // Tail type number
  *           str    tident;           // name for tail column
  *           bool   tkey;             // tail values are unique
- *           bool   tunique;          // tail values must be kept unique
  *           bool   tnonil;           // tail has no nils
  *           bool   tsorted;          // are tail values currently ordered?
  *           bool   tvarsized;        // for speed: tail type is varsized?
@@ -755,7 +754,6 @@ typedef struct {
        uint8_t shift;          /* log2 of bun width */
        bool varsized:1,        /* varsized/void (true) or fixedsized (false) */
                key:1,          /* no duplicate values present */
-               unique:1,       /* no duplicate values allowed */
                nonil:1,        /* there are no nils in the column */
                nil:1,          /* there is a nil in the column */
                sorted:1,       /* column is sorted in ascending order */
@@ -822,7 +820,6 @@ typedef struct BATiter {
 /* macros to hide complexity of the BAT structure */
 #define ttype          T.type
 #define tkey           T.key
-#define tunique                T.unique
 #define tvarsized      T.varsized
 #define tseqbase       T.seq
 #define tsorted                T.sorted
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -335,7 +335,6 @@ VIEWreset(BAT *b)
                b->batRestricted = BAT_WRITE;
 
                b->tkey = BATtkey(v);
-               b->tunique = false;
 
                /* copy the heaps */
                b->theap = tail;
@@ -360,7 +359,6 @@ VIEWreset(BAT *b)
                b->batDirtydesc = true;
 
                b->tkey = BATtkey(v);
-               b->tunique = false;
 
                /* make the BAT empty and insert all again */
                DELTAinit(b);
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -82,7 +82,6 @@ BATcreatedesc(oid hseq, int tt, bool hea
 
        bn->ttype = tt;
        bn->tkey = false;
-       bn->tunique = false;
        bn->tnonil = true;
        bn->tnil = false;
        bn->tsorted = bn->trevsorted = ATOMlinear(tt);
@@ -963,8 +962,7 @@ setcolprops(BAT *b, const void *x)
                prv = BUNtail(bi, pos - 1);
                cmp = ATOMcmp(b->ttype, prv, x);
 
-               if (!b->tunique && /* assume outside check if tunique */
-                   b->tkey &&
+               if (b->tkey &&
                    (cmp == 0 || /* definitely not KEY */
                     (b->batCount > 1 && /* can't guarantee KEY if unordered */
                      ((b->tsorted && cmp > 0) ||
@@ -1040,9 +1038,6 @@ BUNappend(BAT *b, const void *t, bool fo
        BATcheck(b, "BUNappend", GDK_FAIL);
 
        assert(!VIEWtparent(b));
-       if (b->tunique && BUNfnd(b, t) != BUN_NONE) {
-               return GDK_SUCCEED;
-       }
 
        p = BUNlast(b);         /* insert at end */
        if (p == BUN_MAX || b->batCount == BUN_MAX) {
@@ -1381,7 +1376,7 @@ BUNinplace(BAT *b, BUN p, const void *t,
                }
        } else if (b->tnorevsorted >= p)
                b->tnorevsorted = 0;
-       if (((b->ttype != TYPE_void) & b->tkey & !b->tunique) && b->batCount > 
1) {
+       if (((b->ttype != TYPE_void) & b->tkey) && b->batCount > 1) {
                BATkey(b, false);
        } else if (!b->tkey && (b->tnokey[0] == p || b->tnokey[1] == p))
                b->tnokey[0] = b->tnokey[1] = 0;
@@ -1408,9 +1403,6 @@ BUNreplace(BAT *b, oid id, const void *t
        if (id < b->hseqbase || id >= b->hseqbase + BATcount(b))
                return GDK_SUCCEED;
 
-       if (b->tunique && BUNfnd(b, t) != BUN_NONE) {
-               return GDK_SUCCEED;
-       }
        if (b->ttype == TYPE_void) {
                /* no need to materialize if value doesn't change */
                if (is_oid_nil(b->tseqbase) ||
@@ -1433,8 +1425,6 @@ void_inplace(BAT *b, oid id, const void 
                GDKerror("void_inplace: id out of range\n");
                return GDK_FAIL;
        }
-       if (b->tunique && BUNfnd(b, val) != BUN_NONE)
-               return GDK_SUCCEED;
        if (b->ttype == TYPE_void)
                return GDK_SUCCEED;
        return BUNinplace(b, id - b->hseqbase, val, force);
@@ -1591,7 +1581,6 @@ BATkey(BAT *b, bool flag)
 {
        BATcheck(b, "BATkey", GDK_FAIL);
        assert(b->batCacheid > 0);
-       assert(!b->tunique || flag);
        if (b->ttype == TYPE_void) {
                if (BATtdense(b) && !flag) {
                        GDKerror("BATkey: dense column must be unique.\n");
@@ -2130,11 +2119,6 @@ BATmode(BAT *b, bool transient)
  * nokey       Pair of BUN positions that proof not all values are
  *             distinct (i.e. values at given locations are equal).
  *
- * In addition there is a property "unique" that, when set, indicates
- * that values must be kept unique (and hence that the "key" property
- * must be set).  This property is only used when changing (adding,
- * replacing) values.
- *
  * Note that the functions BATtseqbase and BATkey also set more
  * properties than you might suspect.  When setting properties on a
  * newly created and filled BAT, you may want to first make sure the
@@ -2171,7 +2155,6 @@ BATassertProps(BAT *b)
        assert(b->ttype >= TYPE_void);
        assert(b->ttype < GDKatomcnt);
        assert(b->ttype != TYPE_bat);
-       assert(!b->tunique || b->tkey); /* if unique, then key */
        assert(isVIEW(b) ||
               b->ttype == TYPE_void ||
               BBPfarms[b->theap.farmid].roles & (1 << b->batRole));
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -478,8 +478,6 @@ append_varsized_bat(BAT *b, BAT *n, BAT 
        return GDK_SUCCEED;
 
       bunins_failed:
-       if (b->tunique)
-               BBPunfix(s->batCacheid);
        return GDK_FAIL;
 }
 
@@ -515,44 +513,17 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
                }
        }
 
-       if (b->tunique) {
-               /* if b has the unique bit set, only insert values
-                * from n that don't already occur in b, and make sure
-                * we don't insert any duplicates either; we do this
-                * by calculating a subset of n that complies with
-                * this */
-               BAT *d;
-
-               d = BATdiff(n, b, s, NULL, true, false, BUN_NONE);
-               if (d == NULL)
-                       return GDK_FAIL;
-               s = BATunique(n, d);
-               BBPunfix(d->batCacheid);
-               if (s == NULL)
-                       return GDK_FAIL;
-               if (BATcount(s) == 0) {
-                       /* no new values in subset of n */
-                       BBPunfix(s->batCacheid);
-                       return GDK_SUCCEED;
-               }
-       }
-
        cnt = canditer_init(&ci, n, s);
        if (cnt == 0) {
-               assert(!b->tunique);
                return GDK_SUCCEED;
        }
 
        if (BUNlast(b) + cnt > BUN_MAX) {
-               if (b->tunique)
-                       BBPunfix(s->batCacheid);
                GDKerror("BATappend: combined BATs too large\n");
                return GDK_FAIL;
        }
 
        if (b->hseqbase + BATcount(b) + cnt >= GDK_oid_max) {
-               if (b->tunique)
-                       BBPunfix(s->batCacheid);
                GDKerror("BATappend: overflow of head value\n");
                return GDK_FAIL;
        }
@@ -615,8 +586,6 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
                        if (BATcount(b) == 0)
                                BATtseqbase(b, n->tseqbase + ci.seq - hseq);
                        BATsetcount(b, BATcount(b) + cnt);
-                       if (b->tunique)
-                               BBPunfix(s->batCacheid);
                        return GDK_SUCCEED;
                }
                if ((BATcount(b) == 0 || is_oid_nil(b->tseqbase)) &&
@@ -624,8 +593,6 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
                        /* both b and n are void/nil */
                        BATtseqbase(b, oid_nil);
                        BATsetcount(b, BATcount(b) + cnt);
-                       if (b->tunique)
-                               BBPunfix(s->batCacheid);
                        return GDK_SUCCEED;
                }
                /* we need to materialize b; allocate enough capacity */
@@ -674,9 +641,8 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
                        b->tnosorted = 0;
                        b->tnorevsorted = 0;
                }
-               /* if tunique, uniqueness is guaranteed above */
-               b->tkey = n->tkey | b->tunique;
-               if (!b->tunique && cnt == BATcount(n)) {
+               b->tkey = n->tkey;
+               if (cnt == BATcount(n)) {
                        b->tnokey[0] = n->tnokey[0];
                        b->tnokey[1] = n->tnokey[1];
                } else {
@@ -699,8 +665,7 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
                        b->trevsorted = false;
                        b->tnorevsorted = 0;
                }
-               if (!b->tunique && /* uniqueness is guaranteed above */
-                   b->tkey &&
+               if (b->tkey &&
                    (!(BATtordered(b) || BATtrevordered(b)) ||
                     !n->tkey || xx == 0)) {
                        BATkey(b, false);
@@ -716,14 +681,10 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
        }
        if (b->ttype == TYPE_str) {
                if (insert_string_bat(b, n, s, force) != GDK_SUCCEED) {
-                       if (b->tunique)
-                               BBPunfix(s->batCacheid);
                        return GDK_FAIL;
                }
        } else if (ATOMvarsized(b->ttype)) {
                if (append_varsized_bat(b, n, s) != GDK_SUCCEED) {
-                       if (b->tunique)
-                               BBPunfix(s->batCacheid);
                        return GDK_FAIL;
                }
        } else {
@@ -752,12 +713,9 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
                }
                b->theap.dirty = true;
        }
-       if (b->tunique)
-               BBPunfix(s->batCacheid);
        return GDK_SUCCEED;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to