Changeset: 067073ba73f5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=067073ba73f5
Modified Files:
        sql/storage/bat/bat_storage.c
        sql/storage/bat/bat_table.c
        sql/storage/store.c
Branch: newstorage
Log Message:

debugged create_col(). full_column() returns full bat without any filtering 
applied yet. same for SQLtid.


diffs (truncated from 592 to 300 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -186,8 +186,6 @@ bind_uidx(sql_trans *tr, sql_idx * i, in
 {
        BAT *u = NULL, *d, *r;
 
-       printf("#in bind_uidx\n");
-
        if (!i->data) {
                sql_idx *oi = tr_find_idx(tr->parent, i);
                i->data = timestamp_delta(oi->data, tr->stime);
@@ -212,42 +210,21 @@ delta_bind_bat( sql_delta *bat, int acce
 {
        BAT *b;
 
-       printf("#in delta_bind_bat\n");
-       (void)temp;
-
        assert(access == RDONLY || access == RD_INS);
        assert(bat != NULL);
        (void)access;
-       /*if (temp || access == RD_INS) {
-               assert(bat->ibid);
-               b = temp_descriptor(bat->ibid);
-               if (BATcount(b) && bat->ubid) {
-                       BAT *upd = temp_descriptor(bat->ubid), *updins;
-                       
-                       updins = BATsemijoin(upd, b);
-                       bat_destroy(upd);
-                       void_replace_bat(b, updins, TRUE);
-                       bat_destroy(updins);
-               }
-       } else if (!bat->bid) {
-               int tt = 0;
-               b = temp_descriptor(bat->ibid);
-               tt = b->ttype;
-               bat_destroy(b);
-               b = e_BAT(tt);
-       } else { */
+       (void)temp;
+
        b = temp_descriptor(bat->bid);
+       assert(b);
        bat_set_access(b, BAT_READ);
-       //}
-       assert(b);
+
        return b;
 }
 
 static BAT *
 bind_col(sql_trans *tr, sql_column *c, int access)
 {
-       printf("#in bind_col\n");
-
        if (!c->data) {
                sql_column *oc = tr_find_column(tr->parent, c);
                c->data = timestamp_delta(oc->data, tr->stime);
@@ -381,58 +358,22 @@ delta_update_val( sql_delta *bat, oid ri
 static int
 dup_delta(sql_trans *tr, sql_delta *obat, sql_delta *bat, int type, int 
oc_isnew, int c_isnew, int temp, int sz)
 {
-       printf("#in dup_delta\n");
-       (void)temp; (void)tr; (void)type; (void)oc_isnew; (void)sz;
+       (void)tr; (void)type; (void)oc_isnew; (void)sz;
 
        if (!obat)
                return LOG_OK;
-       //bat->ibid = obat->ibid;
-       if(obat->bid)
-               bat->bid = obat->bid;
-       if(obat->ubid)
-               bat->ubid = obat->ubid;
-       if(obat->ibase)
-               bat->ibase = obat->ibase;
-       if(obat->cnt)
-               bat->cnt = obat->cnt;
-       if(obat->ucnt)
-               bat->ucnt = obat->ucnt;
-       if(obat->wtime)
-               bat->wtime = obat->wtime;
-
-       if(obat->name)
-               bat->name = _STRDUP(obat->name);
+
+       bat->bid = obat->bid;
+       bat->ubid = obat->ubid;
+       bat->ibase = obat->ibase;
+       bat->cnt = obat->cnt;
+       bat->ucnt = obat->ucnt;
+       bat->wtime = obat->wtime;
+       bat->name = _STRDUP(obat->name);
 
        if (!bat->bid)
                return LOG_OK;
-       //if (bat->ibid) {
-               //BAT *b;
-               //if (temp) {
-               //      bat->ibid = temp_copy(bat->ibid, 1);
-               //} else if (oc_isnew && !bat->bid) {
-                       /* move the bat to the new col, fixup the old col*/
-                       //b = bat_new(TYPE_void, type, sz);
-                       //bat_set_access(b, BAT_READ);
-                       //obat->ibid = temp_create(b);
-                       //obat->ibase = bat->ibase = (oid) obat->cnt;
-                       //BATseqbase(b, obat->ibase);
-                       //bat_destroy(b);
-                       //if (c_isnew && tr->parent == gtrans) {
-                               /* new cols are moved to gtrans and bat.bid */
-                               //temp_dup(bat->bid);
-                               //obat->bid = bat->bid;
-                       //} else if (!c_isnew) {
-                       //      bat->bid = bat->ibid;
-
-                       //      b = bat_new(TYPE_void, type, sz);
-                       //      bat_set_access(b, BAT_READ);
-                       //      BATseqbase(b, bat->ibase);
-                       //      bat->ibid = temp_create(b);
-                       //}
-               //} else { /* old column */
-               //      bat->ibid = ebat_copy(bat->ibid, bat->ibase, 0);
-               //}
-       //}
+
        if (!temp && bat->bid) {
                if (bat->ubid) {
                        if (c_isnew && tr->parent == gtrans) {
@@ -445,7 +386,7 @@ dup_delta(sql_trans *tr, sql_delta *obat
                        obat->ubid = e_ubat(type);
                }
        }
-       //if (bat->bid)
+
        temp_dup(bat->bid);
 
        return LOG_OK;
@@ -1212,8 +1153,6 @@ sorted_col(sql_trans *tr, sql_column *co
 {
        int sorted = 0;
 
-       printf("#in sorted_col\n");
-
        /* fallback to central bat */
        if (tr && tr->parent && !col->data) {
                col = find_col(tr->parent, 
@@ -1246,7 +1185,6 @@ load_delta(sql_delta *bat, int bid, int 
        bat->cnt = bat->ibase; 
        bat->ucnt = 0; 
        bat->ubid = e_ubat(type);
-       //bat->ibid = e_bat(type);
        return LOG_OK;
 }
 
@@ -1264,11 +1202,7 @@ static int
 log_create_delta(sql_delta *bat) 
 {
        int ok = LOG_OK;
-       BAT *b =  temp_descriptor(bat->bid);/*(bat->bid)?
-                       temp_descriptor(bat->bid):
-                       temp_descriptor(bat->ibid);*/
-
-       printf("#in log_create_delta\n");
+       BAT *b =  temp_descriptor(bat->bid);
 
        if (!bat->ubid) 
                bat->ubid = e_ubat(b->ttype);
@@ -1284,11 +1218,7 @@ static int
 snapshot_new_persistent_bat(sql_trans *tr, sql_delta *bat) 
 {
        int ok = LOG_OK;
-       BAT *b = temp_descriptor(bat->bid);/*(bat->bid)?
-                       temp_descriptor(bat->bid):
-                       temp_descriptor(bat->ibid);*/
-
-       printf("#in snapshot_new_persistent_bat\n");
+       BAT *b = temp_descriptor(bat->bid);
 
        (void)tr;
        /* snapshot large bats */
@@ -1301,72 +1231,6 @@ snapshot_new_persistent_bat(sql_trans *t
        return ok;
 }
 
-static int
-new_persistent_delta( sql_delta *bat, int sz )
-{
-       if (bat->bid) { /* result of alter ! */
-               BAT *b = temp_descriptor(bat->bid);
-               //BAT *i = temp_descriptor(bat->ibid);
-               bat->ibase = BATcount(b);
-               bat->cnt = BATcount(b);// + BATcount(i);
-               bat->ucnt = 0;
-               //bat->ibid = temp_copy(i->batCacheid, FALSE);
-               //bat_destroy(i);
-               //i = temp_descriptor(bat->ibid);
-               //bat_set_access(i, BAT_READ);
-               //BATseqbase(i, bat->ibase);
-               //bat_destroy(i);
-       } else {
-               BAT *b = temp_descriptor(bat->bid);
-               int type = b->ttype;
-
-               b = bat_new(TYPE_void, type, sz);
-               bat_set_access(b, BAT_READ);
-               BATseqbase(b, bat->ibase);
-               bat->bid = temp_create(b);
-               bat->cnt = bat->ibase = BATcount(b);
-               bat->ucnt = 0;
-
-               bat_destroy(b);
-       }
-       return LOG_OK;
-}
-
-static int
-new_persistent_bat(sql_trans *tr, sql_delta *bat, int sz) 
-{
-       (void)tr;
-
-       printf("#in new_persistent_bat\n");
-
-       return new_persistent_delta(bat, sz);
-}
-
-static void
-create_delta( sql_delta *d, BAT *b, BAT *i, bat u)
-{
-
-       printf("#in create_delta\n");
-
-       d->cnt = BATcount(i);
-       bat_set_access(i, BAT_READ);
-       d->bid = temp_create(i);
-       d->ibase = i->H->seq;
-       //d->ibid = temp_create(i);
-       if (b) {
-               d->cnt += BATcount(b);
-               bat_set_access(b, BAT_READ);
-               d->bid = temp_create(b);
-       }
-       d->ubid = u;
-       d->ucnt = 0;
-       if (u) {
-               BAT *U = BBPquickdesc(ABS(u), 0);
-
-               d->ucnt = BATcount(U);
-       }
-}
-
 static bat
 copyBat (bat i, int type, oid seq)
 {
@@ -1403,6 +1267,7 @@ create_col(sql_trans *tr, sql_column *c)
        int ok = LOG_OK;
        int type = c->type.type->localtype;
        sql_delta *bat = c->data;
+       BAT *b;
 
        printf("#in create_col\n");
 
@@ -1414,31 +1279,36 @@ create_col(sql_trans *tr, sql_column *c)
        if (!bat->name) 
                bat->name = sql_message("%s_%s_%s", c->t->s->base.name, 
c->t->base.name, c->base.name);
 
-       if (c->base.flag == TR_OLD && !isTempTable(c->t)){
+       if (c->base.flag == TR_OLD && !isTempTable(c->t))
                return load_bat(bat, type);
-       } else if (bat && bat->bid && !isTempTable(c->t)) {
-               return new_persistent_bat(tr, c->data, c->t->sz);
-       } else if (!bat->bid) {
-               sql_column *fc = NULL;
-               size_t cnt = 0;
-
-               /* alter ? */
-               if (c->t->columns.set && (fc = c->t->columns.set->h->data) != 
NULL) 
-                       cnt = count_col(tr, fc, 1);
-               if (cnt && fc != c) {
-                       sql_delta *d = fc->data;
-
-                       bat->bid = copyBat(d->bid, type, 0);
-                       bat->ibase = d->ibase;
-                       bat->cnt = d->cnt;
-                       if (d->ubid)
-                               bat->ubid = e_ubat(type);
-               } else {
-                       BAT *b = bat_new(TYPE_void, type, c->t->sz);
-                       if (!b) 
-                               return LOG_ERR;
-                       create_delta(c->data, NULL, b, 0);
-                       bat_destroy(b);
+       else {
+               if (!bat->bid) {
+                       sql_column *fc = NULL;
+                       size_t cnt = 0;
+
+                       /* alter ? */
+                       if (c->t->columns.set && (fc = 
c->t->columns.set->h->data) != NULL)
+                               cnt = count_col(tr, fc, 1);
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to