Changeset: 1e0cef7a0cf1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1e0cef7a0cf1
Modified Files:
        clients/Tests/exports.stable.out
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_align.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_calc.c
        gdk/gdk_group.c
        gdk/gdk_logger.c
        gdk/gdk_select.c
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_profiler.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/mal/batcalc.c
        monetdb5/modules/mal/inspect.c
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/querylog.c
        sql/backends/monet5/sql.c
        sql/storage/bat/bat_storage.c
        sql/storage/bat/bat_table.c
        sql/storage/bat/bat_utils.c
Branch: default
Log Message:

Headless cleanup
BATcopy phase 1. Renamed to COLcopy()
calling the deprecated version still.
Leaving assertions where it is not known that the head is void.


diffs (truncated from 620 to 300 lines):

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
@@ -106,7 +106,6 @@ void BATcommit(BAT *b);
 BAT *BATconst(BAT *l, int tt, const void *val, int role);
 BAT *BATconstant(int tt, const void *val, BUN cnt, int role);
 BAT *BATconvert(BAT *b, BAT *s, int tp, int abort_on_error);
-BAT *BATcopy(BAT *b, int ht, int tt, int writeable, int role);
 BUN BATcount_no_nil(BAT *b);
 gdk_return BATdel(BAT *b, BAT *c, bit force);
 BAT *BATdelta(BAT *b);
@@ -211,6 +210,7 @@ BUN BUNdelete(BAT *b, BUN p, bit force);
 BUN BUNfnd(BAT *b, const void *right);
 gdk_return BUNinplace(BAT *b, BUN p, const void *left, const void *right, bit 
force);
 gdk_return BUNreplace(BAT *b, const void *left, const void *right, bit force);
+BAT *COLcopy(BAT *b, int tt, int writeable, int role);
 size_t GDK_mem_maxsize;
 size_t GDK_vm_maxsize;
 int GDK_vm_trim;
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1461,7 +1461,7 @@ gdk_export int BATgetaccess(BAT *b);
  * @item BAT *
  * @tab BATclear (BAT *b, int force)
  * @item BAT *
- * @tab BATcopy (BAT *b, int ht, int tt, int writeable, int role)
+ * @tab COLcopy (BAT *b, int tt, int writeable, int role)
  * @item BAT *
  * @tab BATmark (BAT *b, oid base)
  * @item BAT *
@@ -1473,7 +1473,7 @@ gdk_export int BATgetaccess(BAT *b);
  *
  * The routine BATclear removes the binary associations, leading to an
  * empty, but (re-)initialized BAT. Its properties are retained.  A
- * temporary copy is obtained with BATcopy. The new BAT has an unique
+ * temporary copy is obtained with Colcopy. The new BAT has an unique
  * name.  The routine BATmark creates a binary association that
  * introduces a new tail column of fresh densely ascending OIDs.  The
  * base OID can be given explicitly, or if oid_nil is passed, is
@@ -1485,7 +1485,7 @@ gdk_export int BATgetaccess(BAT *b);
  * exist at the same time.
  */
 gdk_export gdk_return BATclear(BAT *b, int force);
-gdk_export BAT *BATcopy(BAT *b, int ht, int tt, int writeable, int role);
+gdk_export BAT *COLcopy(BAT *b, int tt, int writeable, int role);
 gdk_export BAT *BATmark(BAT *b, oid base);
 gdk_export BAT *BATmark_grp(BAT *b, BAT *g, const oid *base);
 
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2533,7 +2533,7 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e,
                if (BATtdense(g)) {
                        /* singleton groups, so calculating quantile is
                         * easy */
-                       bn = BATcopy(b, TYPE_void, b->ttype, 0, TRANSIENT);
+                       bn = COLcopy(b, b->ttype, 0, TRANSIENT);
                        BATseqbase(bn, g->tseqbase);
                        if (freeg)
                                BBPunfix(g->batCacheid);
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -24,7 +24,7 @@
  * shuffles the first argument, such that the BUNs are in the same
  * order as those in the second argument.  This operation will mark
  * both columns of the first @emph{BAT} as synced with the second
- * (likewise, @emph{BATcopy()}, which makes a copy, instead of
+ * (likewise, @emph{Colcopy()}, which makes a copy, instead of
  * in-place shuffling, has the same alignment effect, @emph{BATmark()}
  * marks the tail column as synced with the head of the original
  * @emph{BAT}).
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -650,8 +650,8 @@ BATdestroy( BATstore *bs )
  *   implementation. We may even want to allow 'dirty' trick such as
  *   viewing a flt-column suddenly as int.
  *
- *   To allow such changes, the desired head- and tail-types are a
- *   parameter of BATcopy.
+ *   To allow such changes, the desired column-types is a
+ *   parameter of COLcopy.
  *
  * - access mode. If we want a read-only copy of a read-only BAT, a
  *   VIEW may do (in this case, the user may be after just an
@@ -723,7 +723,7 @@ wrongtype(int t1, int t2)
  * do inline array[T] inserts.
  */
 /* TODO make it simpler, ie copy per column */
-BAT *
+static BAT *
 BATcopy(BAT *b, int ht, int tt, int writable, int role)
 {
        BUN bunstocopy = BUN_NONE;
@@ -953,6 +953,12 @@ BATcopy(BAT *b, int ht, int tt, int writ
        return NULL;
 }
 
+BAT *
+COLcopy(BAT *b, int tt, int writable, int role)
+{
+       return BATcopy(b, TYPE_void, tt, writable, role);
+}
+
 #ifdef HAVE_HGE
 #define un_move_sz16(src, dst, sz)                                     \
                if (sz == 16) {                                         \
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1194,7 +1194,7 @@ BATsubsort(BAT **sorted, BAT **order, BA
                 * return group information, or we can trivially
                 * deduce the groups */
                if (sorted) {
-                       bn = BATcopy(b, TYPE_void, b->ttype, 0, TRANSIENT);
+                       bn = COLcopy(b, b->ttype, 0, TRANSIENT);
                        if (bn == NULL)
                                goto error;
                        *sorted = bn;
@@ -1235,12 +1235,12 @@ BATsubsort(BAT **sorted, BAT **order, BA
                if (bn == NULL)
                        goto error;
                if (bn->ttype == TYPE_void || isVIEW(bn)) {
-                       b = BATcopy(bn, TYPE_void, ATOMtype(bn->ttype), TRUE, 
TRANSIENT);
+                       b = COLcopy(bn, ATOMtype(bn->ttype), TRUE, TRANSIENT);
                        BBPunfix(bn->batCacheid);
                        bn = b;
                }
        } else {
-               bn = BATcopy(b, TYPE_void, b->ttype, TRUE, TRANSIENT);
+               bn = COLcopy(b, b->ttype, TRUE, TRANSIENT);
        }
        if (bn == NULL)
                goto error;
@@ -1250,7 +1250,7 @@ BATsubsort(BAT **sorted, BAT **order, BA
                        /* make copy of input so that we can refine it;
                         * copy can be read-only if we take the shortcut
                         * below in the case g is "key" */
-                       on = BATcopy(o, TYPE_void, TYPE_oid,
+                       on = COLcopy(o, TYPE_oid,
                                     g == NULL ||
                                     !(g->tkey || g->ttype == TYPE_void),
                                     TRANSIENT);
@@ -1302,7 +1302,7 @@ BATsubsort(BAT **sorted, BAT **order, BA
                                }
                        }
                        if (groups) {
-                               gn = BATcopy(g, TYPE_void, g->ttype, 0, 
TRANSIENT);
+                               gn = COLcopy(g, g->ttype, 0, TRANSIENT);
                                if (gn == NULL)
                                        goto error;
                                *groups = gn;
@@ -1403,7 +1403,8 @@ BATmark(BAT *b, oid oid_base)
                if (BAThrestricted(b) != BAT_READ) {
                        BAT *v = bn;
 
-                       bn = BATcopy(v, v->htype, v->ttype, TRUE, TRANSIENT);
+                       assert(v->htype == TYPE_void);
+                       bn = COLcopy(v, v->ttype, TRUE, TRANSIENT);
                        BBPreclaim(v);
                }
        }
@@ -1718,10 +1719,10 @@ BATmergecand(BAT *a, BAT *b)
 
        /* we can return a if b is empty (and v.v.) */
        if (BATcount(a) == 0) {
-               return BATcopy(b, b->htype, b->ttype, 0, TRANSIENT);
+               return COLcopy(b, b->ttype, 0, TRANSIENT);
        }
        if (BATcount(b) == 0) {
-               return BATcopy(a, a->htype, a->ttype, 0, TRANSIENT);
+               return COLcopy(a, a->ttype, 0, TRANSIENT);
        }
        /* we can return a if a fully covers b (and v.v) */
        ai = bat_iterator(a);
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -14151,8 +14151,10 @@ BATconvert(BAT *b, BAT *s, int tp, int a
 
        CANDINIT(b, s, start, end, cnt, cand, candend);
 
-       if (s == NULL && tp != TYPE_bit && ATOMbasetype(b->T->type) == 
ATOMbasetype(tp))
-               return BATcopy(b, b->H->type, tp, 0, TRANSIENT);
+       if (s == NULL && tp != TYPE_bit && ATOMbasetype(b->T->type) == 
ATOMbasetype(tp)){
+               assert(b->H->type == TYPE_void);
+               return COLcopy(b, tp, 0, TRANSIENT);
+       }
 
        bn = BATnew(TYPE_void, tp, b->batCount, TRANSIENT);
        if (bn == NULL)
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -499,18 +499,21 @@ BATgroup_internal(BAT **groups, BAT **ex
                                  e ? BATgetId(e) : "NULL", e ? BATcount(e) : 0,
                                  h ? BATgetId(h) : "NULL", h ? BATcount(h) : 0,
                                  subsorted);
-                       gn = BATcopy(g, g->htype, g->ttype, 0, TRANSIENT);
+                       assert(g->htype == TYPE_void);
+                       gn = COLcopy(g, g->ttype, 0, TRANSIENT);
                        if (gn == NULL)
                                goto error;
                        *groups = gn;
                        if (extents) {
-                               en = BATcopy(e, e->htype, e->ttype, 0, 
TRANSIENT);
+                               assert(e->htype == TYPE_void);
+                               en = COLcopy(e, e->ttype, 0, TRANSIENT);
                                if (en == NULL)
                                        goto error;
                                *extents = en;
                        }
                        if (histo) {
-                               hn = BATcopy(h, h->htype, h->ttype, 0, 
TRANSIENT);
+                               assert(h->htype == TYPE_void);
+                               hn = COLcopy(h, h->ttype, 0, TRANSIENT);
                                if (hn == NULL)
                                        goto error;
                                *histo = hn;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1622,8 +1622,8 @@ logger_load(int debug, const char* fn, c
                        if (o_id == NULL || o_val == NULL)
                                logger_fatal("Logger_new: inconsistent 
database: cannot find seqs bats", 0, 0, 0);
 
-                       lg->seqs_id = BATcopy(o_id, TYPE_void, TYPE_int, 1, 
TRANSIENT);
-                       lg->seqs_val = BATcopy(o_val, TYPE_void, TYPE_lng, 1, 
TRANSIENT);
+                       lg->seqs_id = COLcopy(o_id, TYPE_int, 1, TRANSIENT);
+                       lg->seqs_val = COLcopy(o_val, TYPE_lng, 1, TRANSIENT);
                        BBPunfix(o_id->batCacheid);
                        BBPunfix(o_val->batCacheid);
                        BATseqbase(lg->seqs_id, 0);
@@ -1650,7 +1650,7 @@ logger_load(int debug, const char* fn, c
                if (lg->snapshots_bid->htype == TYPE_oid) {
                        BAT *b;
                        assert(lg->snapshots_tid->htype == TYPE_oid);
-                       b = BATcopy(lg->snapshots_bid, TYPE_void, 
lg->snapshots_bid->ttype, 1, PERSISTENT);
+                       b = COLcopy(lg->snapshots_bid, 
lg->snapshots_bid->ttype, 1, PERSISTENT);
                        BATseqbase(b, 0);
                        BATsetaccess(b, BAT_READ);
                        snprintf(bak, sizeof(bak), "tmp_%o", 
lg->snapshots_bid->batCacheid);
@@ -1661,7 +1661,7 @@ logger_load(int debug, const char* fn, c
                        logbat_destroy(lg->snapshots_bid);
                        lg->snapshots_bid = b;
                        logger_add_bat(lg, b, "snapshots_bid");
-                       b = BATcopy(lg->snapshots_tid, TYPE_void, 
lg->snapshots_tid->ttype, 1, PERSISTENT);
+                       b = COLcopy(lg->snapshots_tid, 
lg->snapshots_tid->ttype, 1, PERSISTENT);
                        BATseqbase(b, 0);
                        BATsetaccess(b, BAT_READ);
                        snprintf(bak, sizeof(bak), "tmp_%o", 
lg->snapshots_tid->batCacheid);
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1385,7 +1385,7 @@ BATselect(BAT *b, BAT *s, const void *tl
                                  s ? BATgetId(s) : "NULL",
                                  s && BATtdense(s) ? "(dense)" : "", anti);
                if (s) {
-                       return BATcopy(s, TYPE_void, s->ttype, 0, TRANSIENT);
+                       return COLcopy(s, s->ttype, 0, TRANSIENT);
                } else {
                        return BATmirror(BATmark(b, 0));
                }
diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c
--- a/monetdb5/mal/mal_authorize.c
+++ b/monetdb5/mal/mal_authorize.c
@@ -186,7 +186,7 @@ AUTHinitTables(str *passwd) {
                bat blist[5];
                assert(pass->htype == TYPE_oid);
                blist[0] = 0;
-               b = BATcopy(user, TYPE_void, user->ttype, 1, PERSISTENT);
+               b = COLcopy(user, user->ttype, 1, PERSISTENT);
                BATseqbase(b, 0);
                BATmode(b, PERSISTENT);
                BATmode(user, TRANSIENT);
@@ -197,7 +197,7 @@ AUTHinitTables(str *passwd) {
                blist[2] = b->batCacheid;
                BBPunfix(user->batCacheid);
                user = b;
-               b = BATcopy(pass, TYPE_void, pass->ttype, 1, PERSISTENT);
+               b = COLcopy(pass, pass->ttype, 1, PERSISTENT);
                BATseqbase(b, 0);
                BATmode(b, PERSISTENT);
                BATmode(pass, TRANSIENT);
@@ -604,7 +604,7 @@ AUTHgetUsers(BAT **ret1, BAT **ret2, Cli
                *ret2 = BATproject(bn, user);
                *ret1 = bn;
        } else {
-               *ret2 = BATcopy(user, TYPE_void, user->ttype, FALSE, TRANSIENT);
+               *ret2 = COLcopy(user, user->ttype, FALSE, TRANSIENT);
        }
        return(NULL);
 }
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -559,19 +559,19 @@ TRACEtable(BAT **r)
        if (TRACE_init == 0)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to