Changeset: d6875b13c087 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d6875b13c087
Modified Files:
        clients/Tests/MAL-signatures-hge.test
        clients/Tests/MAL-signatures.test
        clients/Tests/exports.stable.out
        gdk/ChangeLog.Dec2023
        gdk/gdk.h
        gdk/gdk_bat.c
        gdk/gdk_bbp.c
        gdk/gdk_private.h
        gdk/gdk_storage.c
        gdk/gdk_string.c
        monetdb5/ChangeLog.Dec2023
        monetdb5/mal/Tests/tst1604.maltest
        monetdb5/mal/Tests/tst202.maltest
        monetdb5/mal/Tests/tst210.maltest
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/mal/bbp.c
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/inspect.c
        monetdb5/modules/mal/mdb.c
        testing/mapicursor.py
Branch: Dec2023
Log Message:

Removed BATroles and tident (T.id) field in BATs.
Also removed bat.getRole and bat.setColumn which uses/sets this
information.


diffs (truncated from 819 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -3784,11 +3784,6 @@ command bat.getName(X_0:bat[:any_1]):str
 BKCgetBBPname;
 Gives back the logical name of a BAT.
 bat
-getRole
-command bat.getRole(X_0:bat[:any_1]):str 
-BKCgetRole;
-Returns the rolename of the head column of a BAT.
-bat
 getSequenceBase
 command bat.getSequenceBase(X_0:bat[:any_1]):oid 
 BKCgetSequenceBase;
@@ -4039,11 +4034,6 @@ command bat.setAccess(X_0:bat[:any_1], X
 BKCsetAccess;
 Try to change the update access privileges @to this BAT. Mode:@r[ead-only]     
 - allow only read access.@a[append-only]   - allow reads and 
update.@w[riteable]      - allow all operations.@BATs are updatable by default. 
On making a BAT read-only, @all subsequent updates fail with an error 
message.@Returns the BAT itself.
 bat
-setColumn
-command bat.setColumn(X_0:bat[:any_1], X_1:str):void 
-BKCsetColumn;
-Give a logical name to the tail column of a BAT.
-bat
 setHash
 command bat.setHash(X_0:bat[:any_1]):bit 
 BKCsetHash;
diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -3219,11 +3219,6 @@ command bat.getName(X_0:bat[:any_1]):str
 BKCgetBBPname;
 Gives back the logical name of a BAT.
 bat
-getRole
-command bat.getRole(X_0:bat[:any_1]):str 
-BKCgetRole;
-Returns the rolename of the head column of a BAT.
-bat
 getSequenceBase
 command bat.getSequenceBase(X_0:bat[:any_1]):oid 
 BKCgetSequenceBase;
@@ -3464,11 +3459,6 @@ command bat.setAccess(X_0:bat[:any_1], X
 BKCsetAccess;
 Try to change the update access privileges @to this BAT. Mode:@r[ead-only]     
 - allow only read access.@a[append-only]   - allow reads and 
update.@w[riteable]      - allow all operations.@BATs are updatable by default. 
On making a BAT read-only, @all subsequent updates fail with an error 
message.@Returns the BAT itself.
 bat
-setColumn
-command bat.setColumn(X_0:bat[:any_1], X_1:str):void 
-BKCsetColumn;
-Give a logical name to the tail column of a BAT.
-bat
 setHash
 command bat.setHash(X_0:bat[:any_1]):bit 
 BKCsetHash;
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
@@ -187,7 +187,6 @@ gdk_return BATreplace(BAT *b, BAT *p, BA
 gdk_return BATreplacepos(BAT *b, const oid *positions, BAT *n, bool autoincr, 
bool force) __attribute__((__warn_unused_result__));
 void BATrmprop(BAT *b, enum prop_t idx);
 void BATrmprop_nolock(BAT *b, enum prop_t idx);
-gdk_return BATroles(BAT *b, const char *tnme);
 gdk_return BATrtree(BAT *wkb, BAT *mbr);
 BAT *BATsample(BAT *b, BUN n);
 BAT *BATsample_with_seed(BAT *b, BUN n, uint64_t seed);
diff --git a/gdk/ChangeLog.Dec2023 b/gdk/ChangeLog.Dec2023
--- a/gdk/ChangeLog.Dec2023
+++ b/gdk/ChangeLog.Dec2023
@@ -1,6 +1,9 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Mon Nov 20 2023 Sjoerd Mullender <sjo...@acm.org>
+- Removed function BATroles to set column names on BATs.
+
 * Thu Nov  2 2023 Sjoerd Mullender <sjo...@acm.org>
 - Removed the compiled-in limit on the number of threads that can be used.
   The number of threads are still limited, but the limit is dictated
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -686,7 +686,6 @@ gdk_export bool VALisnil(const ValRecord
  *           BUN    batCount;         // Tuple count
  *           // Tail properties
  *           int    ttype;            // Tail type number
- *           str    tident;           // name for tail column
  *           bool   tkey;             // tail values are unique
  *           bool   tnonil;           // tail has no nils
  *           bool   tsorted;          // are tail values currently ordered?
@@ -718,8 +717,6 @@ typedef struct PROPrec PROPrec;
 /* see also comment near BATassertProps() for more information about
  * the properties */
 typedef struct {
-       str id;                 /* label for column */
-
        uint16_t width;         /* byte-width of the atom array */
        int8_t type;            /* type id. */
        uint8_t shift;          /* log2 of bun width */
@@ -819,7 +816,6 @@ typedef struct BAT {
 #define tseqbase       T.seq
 #define tsorted                T.sorted
 #define trevsorted     T.revsorted
-#define tident         T.id
 #define torderidx      T.orderidx
 #define twidth         T.width
 #define tshift         T.shift
@@ -1422,7 +1418,6 @@ gdk_export void BATsetcount(BAT *b, BUN 
 gdk_export BUN BATgrows(BAT *b);
 gdk_export gdk_return BATkey(BAT *b, bool onoff);
 gdk_export gdk_return BATmode(BAT *b, bool transient);
-gdk_export gdk_return BATroles(BAT *b, const char *tnme);
 gdk_export void BAThseqbase(BAT *b, oid o);
 gdk_export void BATtseqbase(BAT *b, oid o);
 
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -53,16 +53,6 @@
 
 #define ATOMneedheap(tpe) (BATatoms[tpe].atomHeap != NULL)
 
-static char *BATstring_t = "t";
-
-#define default_ident(s)       ((s) == BATstring_t)
-
-void
-BATinit_idents(BAT *bn)
-{
-       bn->tident = BATstring_t;
-}
-
 BAT *
 BATcreatedesc(oid hseq, int tt, bool heapnames, role_t role, uint16_t width)
 {
@@ -90,7 +80,6 @@ BATcreatedesc(oid hseq, int tt, bool hea
                .tnil = false,
                .tsorted = ATOMlinear(tt),
                .trevsorted = ATOMlinear(tt),
-               .tident = BATstring_t,
                .tseqbase = oid_nil,
                .tminpos = BUN_NONE,
                .tmaxpos = BUN_NONE,
@@ -683,9 +672,6 @@ BATfree(BAT *b)
        STRMPfree(b);
        RTREEfree(b);
        MT_lock_set(&b->theaplock);
-       if (b->tident && !default_ident(b->tident))
-               GDKfree(b->tident);
-       b->tident = BATstring_t;
        if (nunique != BUN_NONE) {
                b->tunique_est = (double) nunique;
        }
@@ -722,9 +708,6 @@ BATfree(BAT *b)
 void
 BATdestroy(BAT *b)
 {
-       if (b->tident && !default_ident(b->tident))
-               GDKfree(b->tident);
-       b->tident = BATstring_t;
        if (b->tvheap) {
                ATOMIC_DESTROY(&b->tvheap->refs);
                GDKfree(b->tvheap);
@@ -2208,22 +2191,6 @@ BATtseqbase(BAT *b, oid o)
        }
 }
 
-gdk_return
-BATroles(BAT *b, const char *tnme)
-{
-       if (b == NULL)
-               return GDK_SUCCEED;
-       MT_lock_set(&b->theaplock);
-       if (b->tident && !default_ident(b->tident))
-               GDKfree(b->tident);
-       if (tnme)
-               b->tident = GDKstrdup(tnme);
-       else
-               b->tident = BATstring_t;
-       MT_lock_unset(&b->theaplock);
-       return b->tident ? GDK_SUCCEED : GDK_FAIL;
-}
-
 /*
  * @- Change the BAT access permissions (read, append, write)
  * Regrettably, BAT access-permissions, persistent status and memory
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -648,7 +648,6 @@ BBPreadBBPline(FILE *fp, unsigned bbpver
 #endif
 
        bn->batCacheid = (bat) batid;
-       BATinit_idents(bn);
        bn->batTransient = false;
        bn->batCopiedtodisk = true;
        switch ((properties & 0x06) >> 1) {
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -80,8 +80,6 @@ Hash *BAThash_impl(BAT *restrict b, stru
        __attribute__((__visibility__("hidden")));
 void BAThashsave(BAT *b, bool dosync)
        __attribute__((__visibility__("hidden")));
-void BATinit_idents(BAT *bn)
-       __attribute__((__visibility__("hidden")));
 bool BATiscand(BAT *b)
        __attribute__((__visibility__("hidden")));
 BAT *BATload_intern(bat bid, bool lock)
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -947,14 +947,6 @@ BATprintcolumns(stream *s, int argc, BAT
        for (i = 0; i < argc; i++) {
                if (i > 0)
                        mnstr_write(s, "\t", 1, 1);
-               const char *nm = argv[i]->tident;
-               mnstr_write(s, nm, 1, strlen(nm));
-       }
-       mnstr_write(s, "  # name\n", 1, 9);
-       mnstr_write(s, "# ", 1, 2);
-       for (i = 0; i < argc; i++) {
-               if (i > 0)
-                       mnstr_write(s, "\t", 1, 1);
                const char *nm = ATOMname(argv[i]->ttype);
                mnstr_write(s, nm, 1, strlen(nm));
        }
@@ -997,10 +989,8 @@ BATprint(stream *fdout, BAT *b)
 
                mnstr_printf(fdout,
                             "#--------------------------#\n"
-                            "# h\t%s  # name\n"
                             "# void\toid  # type\n"
-                            "#--------------------------#\n",
-                            b->tident);
+                            "#--------------------------#\n");
                for (BUN i = 0; i < ci.ncand; i++) {
                        oid o = canditer_next(&ci);
                        mnstr_printf(fdout,
@@ -1016,9 +1006,7 @@ BATprint(stream *fdout, BAT *b)
        argv[0] = BATdense(b->hseqbase, b->hseqbase, BATcount(b));
        if (argv[0]) {
                argv[1] = b;
-               ret = BATroles(argv[0], "h");
-               if (ret == GDK_SUCCEED)
-                       ret = BATprintcolumns(fdout, 2, argv);
+               ret = BATprintcolumns(fdout, 2, argv);
                BBPunfix(argv[0]->batCacheid);
        }
        return ret;
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -214,6 +214,7 @@ strPut(BAT *b, var_t *dst, const void *V
        bucket = ((stridx_t *) h->base) + off;
 
        if (*bucket) {
+               assert(*bucket < h->free);
                /* the hash list is not empty */
                if (*bucket < GDK_ELIMLIMIT) {
                        /* small string heap (<64KiB) -- fully double
@@ -222,6 +223,7 @@ strPut(BAT *b, var_t *dst, const void *V
 
                        do {
                                pos = *ref + sizeof(stridx_t);
+                               assert(pos < h->free);
                                if (strcmp(v, h->base + pos) == 0) {
                                        /* found */
                                        return *dst = (var_t) pos;
diff --git a/monetdb5/ChangeLog.Dec2023 b/monetdb5/ChangeLog.Dec2023
--- a/monetdb5/ChangeLog.Dec2023
+++ b/monetdb5/ChangeLog.Dec2023
@@ -1,6 +1,10 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Mon Nov 20 2023 Sjoerd Mullender <sjo...@acm.org>
+- Removed MAL functions bat.getRole and bat.setColumn since the
+  underlying function BATroles was removed.
+
 * Fri Oct 20 2023 Panagiotis Koutsourakis <kutsu...@monetdbsolutions.com>
 - Change how json is stored in the database: We now normalize json
   strings after parsing, removing whitespace and eliminating duplicate
diff --git a/monetdb5/mal/Tests/tst1604.maltest 
b/monetdb5/mal/Tests/tst1604.maltest
--- a/monetdb5/mal/Tests/tst1604.maltest
+++ b/monetdb5/mal/Tests/tst1604.maltest
@@ -2,9 +2,6 @@ statement ok
 t:= bat.new(:str)
 
 statement ok
-bat.setColumn(t,"first")
-
-statement ok
 u:= bat.new(:str)
 
 query ITT rowsort
diff --git a/monetdb5/mal/Tests/tst202.maltest 
b/monetdb5/mal/Tests/tst202.maltest
--- a/monetdb5/mal/Tests/tst202.maltest
+++ b/monetdb5/mal/Tests/tst202.maltest
@@ -4,9 +4,6 @@ statement ok
 statement ok
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to