Changeset: ebb83ca24443 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ebb83ca24443
Modified Files:
        monetdb5/modules/mal/heapn.c
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/pipeline.c
        monetdb5/modules/mal/pp_algebra.c
        monetdb5/modules/mal/pp_hash.c
        monetdb5/modules/mal/pp_hash.h
        monetdb5/modules/mal/pp_mat.c
        monetdb5/modules/mal/pp_mat.h
        monetdb5/modules/mal/pp_slicer.c
        monetdb5/modules/mal/pp_sort.c
        sql/backends/monet5/generator/generator.c
Branch: pp_hashjoin
Log Message:

Use pl_io instead of s. remove not necessary casts.


diffs (truncated from 494 to 300 lines):

diff --git a/monetdb5/modules/mal/heapn.c b/monetdb5/modules/mal/heapn.c
--- a/monetdb5/modules/mal/heapn.c
+++ b/monetdb5/modules/mal/heapn.c
@@ -48,7 +48,7 @@ typedef struct subheap {
 } subheap;
 
 typedef struct heapn {
-       struct pipeline_io s;
+       struct pipeline_io pl_io;
        size_t size;
        size_t used;
        bool full;
@@ -1055,8 +1055,8 @@ _heap_create( int size, bool shared, boo
 {
        heapn *h = (heapn*)GDKzalloc(sizeof(heapn));
 
-       h->s.destroy = (pipeline_io_destroy)heap_destroy;
-       h->s.type = PIPELINE_IO_HEAP;
+       h->pl_io.destroy = (pipeline_io_destroy)heap_destroy;
+       h->pl_io.type = PIPELINE_IO_HEAP;
        h->shared = shared;
        h->grouped = grouped;
        h->size = size;
@@ -1524,7 +1524,7 @@ HEAPtopn(Client cntxt, MalBlkPtr m, MalS
        }
        private = hps->tprivate_bat;
        heapn *hp = (heapn*)hps->pl_io;
-       assert(hp && hp->s.type == PIPELINE_IO_HEAP);
+       assert(hp && hp->pl_io.type == PIPELINE_IO_HEAP);
        if (((hp->sub && hp->sub->vb == NULL) || (hp->grouped && hp->grpb == 
NULL)) && !_heap_init(hp)) {
                BBPreclaim(b);
                BBPreclaim(gps);
diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -61,7 +61,7 @@ MATpackInternal(Client cntxt, MalBlkPtr 
                bat bid = stk->stk[getArg(p, i)].val.bval;
                b = BBPquickdesc(bid);
                mat_t *mp = (mat_t *) b->pl_io;
-               if (mp && mp->s.type == PIPELINE_IO_MAT) {
+               if (mp && mp->pl_io.type == PIPELINE_IO_MAT) {
                        bn = pack_mat(b);
                        if (bn == NULL)
                                throw(MAL, "mat.pack", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
@@ -146,7 +146,7 @@ MATpackIncrement(Client cntxt, MalBlkPtr
 
        if (getArgType(mb, p, 2) == TYPE_int) {
                mat_t *mp = (mat_t *) b->pl_io;
-               if (mp && mp->s.type == PIPELINE_IO_MAT) {
+               if (mp && mp->pl_io.type == PIPELINE_IO_MAT) {
                        bn = pack_mat(b);
                        if (bn == NULL)
                                throw(MAL, "mat.pack", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
diff --git a/monetdb5/modules/mal/pipeline.c b/monetdb5/modules/mal/pipeline.c
--- a/monetdb5/modules/mal/pipeline.c
+++ b/monetdb5/modules/mal/pipeline.c
@@ -133,7 +133,7 @@ sync_counter_done(struct pipeline_counte
        Pipeline *p = MT_thread_getdata();
        MT_lock_set(&p->p->l);
        if (!c->cur)
-               c->cur = (int*)GDKzalloc(sizeof(int) * nr_workers);
+               c->cur = GDKzalloc(sizeof(int) * nr_workers);
        cur = c->current++;
        if (cur >= c->nr) {
                res = 1;
@@ -163,7 +163,7 @@ counter_done(struct pipeline_counter *c,
        int res = 0, cur;
        MT_lock_set(&c->l);
        if (!c->cur)
-               c->cur = (int*)GDKzalloc(sizeof(int) * nr_workers);
+               c->cur = GDKzalloc(sizeof(int) * nr_workers);
        cur = c->current++;
        if (cur >= c->nr) {
                res = 1;
@@ -241,7 +241,7 @@ PPcounter(Client cntxt, MalBlkPtr mb, Ma
                        return createException(SQL, "pipeline.counter", 
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
                size_t cnt = 0;
                hash_table *h = (hash_table*)b->pl_io;
-               if (h && h->s.type == PIPELINE_IO_HASH_TABLE) {
+               if (h && h->pl_io.type == PIPELINE_IO_HASH_TABLE) {
                        cnt = h->size;
                } else {
                        cnt = BATcount(b);
@@ -262,7 +262,7 @@ PPcounter(Client cntxt, MalBlkPtr mb, Ma
        if (pci->argc == 3)
                sync = *getArgReference_bit(stk, pci, 2);
 
-       struct pipeline_counter *c = (struct 
pipeline_counter*)GDKzalloc(sizeof(struct pipeline_counter));
+       struct pipeline_counter *c = GDKzalloc(sizeof(struct pipeline_counter));
        if (!c) {
                throw(SQL, "pipeline.counter",  SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
        }
@@ -330,7 +330,7 @@ concat_done(struct pipeline_concat *c, i
        assert(c->pl_io.type == PIPELINE_IO_CONCAT);
        MT_lock_set(&c->l);
        if (!c->started) {
-               c->cur = (int*)GDKzalloc(sizeof(int) * nr_workers);
+               c->cur = GDKzalloc(sizeof(int) * nr_workers);
                c->started = true;
        }
        BAT *sb = c->srcs[c->cur[wid]];
@@ -463,7 +463,7 @@ PPconcat(Client cntxt, MalBlkPtr mb, Mal
        (void)mb;
        bat *rb = getArgReference_bat(stk, pci, 0);
        int nr = *getArgReference_int(stk, pci, 1);
-       struct pipeline_concat *pcat = (struct 
pipeline_concat*)GDKzalloc(sizeof(struct pipeline_concat) + (nr+1) * 
sizeof(struct pipeline_io*) );
+       struct pipeline_concat *pcat = GDKzalloc(sizeof(struct pipeline_concat) 
+ (nr + 1) * sizeof(struct pipeline_io*));
 
        if (!pcat)
                throw(SQL, "pipeline.concat",  SQLSTATE(HY013) MAL_MALLOC_FAIL);
@@ -494,7 +494,7 @@ PPresultset(Client cntxt, MalBlkPtr mb, 
        (void)cntxt;
        (void)mb;
        bat *rb = getArgReference_bat(stk, pci, 0);
-       struct pipeline_resultset *prs = (struct 
pipeline_resultset*)GDKzalloc(sizeof(struct pipeline_resultset));
+       struct pipeline_resultset *prs = GDKzalloc(sizeof(struct 
pipeline_resultset));
 
        if (!prs)
                throw(SQL, "pipeline.resultset",  SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
diff --git a/monetdb5/modules/mal/pp_algebra.c 
b/monetdb5/modules/mal/pp_algebra.c
--- a/monetdb5/modules/mal/pp_algebra.c
+++ b/monetdb5/modules/mal/pp_algebra.c
@@ -1061,7 +1061,7 @@ LALGunique(Client ctx, bat *rid, bat *ui
        }
 
        hash_table *h = (hash_table*)u->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
        MT_lock_set(&u->theaplock);
        MT_lock_set(&b->theaplock);
        if (ATOMvarsized(u->ttype) /*&& !VIEWvtparent(b)*/) {
@@ -1313,7 +1313,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
        }
 
        hash_table *h = (hash_table*)u->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
        MT_lock_set(&u->theaplock);
        MT_lock_set(&b->theaplock);
        if (ATOMvarsized(u->ttype) /*&& !VIEWvtparent(b)*/) {
@@ -1662,7 +1662,7 @@ LALGgroup(Client ctx, bat *rid, bat *uid
        //(void)sid;
 
        hash_table *h = (hash_table*)u->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
        MT_lock_set(&u->theaplock);
        MT_lock_set(&b->theaplock);
        if ((ATOMvarsized(u->ttype) && !VIEWvtparent(b)) ||
@@ -1956,7 +1956,7 @@ LALGderive(Client ctx, bat *rid, bat *ui
        //(void)sid;
 
        hash_table *h = (hash_table*)u->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
        MT_lock_set(&u->theaplock);
        MT_lock_set(&b->theaplock);
        if ((ATOMvarsized(u->ttype) && !VIEWvtparent(b)) ||
diff --git a/monetdb5/modules/mal/pp_hash.c b/monetdb5/modules/mal/pp_hash.c
--- a/monetdb5/modules/mal/pp_hash.c
+++ b/monetdb5/modules/mal/pp_hash.c
@@ -48,7 +48,7 @@ _ht_init(hash_table *h)
                if (h->vals == NULL || h->gids == NULL)
                        goto error;
                if (h->p) {
-                       assert(h->s.type == PIPELINE_IO_HASH_TABLE);
+                       assert(h->pl_io.type == PIPELINE_IO_HASH_TABLE);
                        h->pgids = (gid*)GDKmalloc(sizeof(gid)* h->size);
                        if (h->pgids == NULL)
                                goto error;
@@ -95,8 +95,8 @@ _ht_create( int type, size_t size, hash_
 
        if (!type)
                type = TYPE_oid;
-       h->s.destroy = (pipeline_io_destroy)&ht_destroy;
-       h->s.type = PIPELINE_IO_HASH_TABLE;
+       h->pl_io.destroy = (pipeline_io_destroy)&ht_destroy;
+       h->pl_io.type = PIPELINE_IO_HASH_TABLE;
        if (bits >= GIDBITS)
                bits = GIDBITS-1;
        h->bits = bits;
@@ -467,7 +467,7 @@ OAHASHhashmark_init(Client ctx, bat *res
     hash_table *h = (hash_table*)ht->pl_io;
        if (hp)
                h = (hash_table*)hp->pl_io;
-       //assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       /* assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE); */
        BUN sz = h?h->last:BATcount(ht); /* no hash ie outer cross product case 
*/
 
        r = COLnew(0, TYPE_bit, sz, TRANSIENT);
@@ -532,7 +532,7 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
        if (!i)
                return createException(MAL, "hash.ext", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        hash_table *h = (hash_table*)i->pl_io;
-       if (!h || h->s.type != PIPELINE_IO_HASH_TABLE) {
+       if (!h || h->pl_io.type != PIPELINE_IO_HASH_TABLE) {
                BBPreclaim(i);
                return createException(MAL, "hash.ext", SQLSTATE(HY002) 
"Missing hash table");
        }
@@ -876,7 +876,7 @@ OAHASHbuild_tbl(Client ctx, bat *slot_id
                goto error;
        }
        hash_table *h = (hash_table*)u->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
 
        BUN cnt = BATcount(b);
        g = COLnew(b->hseqbase, TYPE_oid, cnt, TRANSIENT);
@@ -1278,7 +1278,7 @@ OAHASHbuild_tbl_cmbd(Client ctx, bat *sl
                goto error;
        }
        hash_table *h = (hash_table*)u->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
 
        BUN cnt = BATcount(b);
        g = COLnew(b->hseqbase, TYPE_oid, cnt, TRANSIENT);
@@ -3278,7 +3278,7 @@ OAHASHno_slices(Client ctx, int *no_slic
        if (!b)
                return createException(SQL, "oahash.no_slices", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        hash_table *h = (hash_table*)b->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
 
        if (h->size < SLICE_SIZE )
                *no_slices = 1;
@@ -3301,7 +3301,7 @@ OAHASHnth_slice(Client ctx, bat *slice, 
        if (!b)
                return createException(SQL, "oahash.nth_slice", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        hash_table *h = (hash_table*)b->pl_io;
-       assert(h && h->s.type == PIPELINE_IO_HASH_TABLE);
+       assert(h && h->pl_io.type == PIPELINE_IO_HASH_TABLE);
        BUN s = *slice_nr * SLICE_SIZE, e = s + SLICE_SIZE;
        BAT *r = NULL;
 
diff --git a/monetdb5/modules/mal/pp_hash.h b/monetdb5/modules/mal/pp_hash.h
--- a/monetdb5/modules/mal/pp_hash.h
+++ b/monetdb5/modules/mal/pp_hash.h
@@ -146,7 +146,7 @@ typedef lng (*fhsh)(const void *v);
 typedef size_t (*flen)(const void *v);
 
 typedef struct hash_table {
-       struct pipeline_io s;
+       struct pipeline_io pl_io;
        int type;
        int width;
        fcmp cmp;
diff --git a/monetdb5/modules/mal/pp_mat.c b/monetdb5/modules/mal/pp_mat.c
--- a/monetdb5/modules/mal/pp_mat.c
+++ b/monetdb5/modules/mal/pp_mat.c
@@ -23,7 +23,7 @@
 #include "pipeline.h"
 
 typedef struct part_t {
-       struct pipeline_io s;
+       struct pipeline_io pl_io;
        int nr;
        lng *curpos;
        MT_Lock l;
@@ -104,8 +104,8 @@ MATnew(Client cntxt, MalBlkPtr mb, MalSt
                GDKfree(mat);
                throw(MAL, "mat.new", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        }
-       mat->s.destroy = (pipeline_io_destroy)&mat_destroy;
-       mat->s.type = PIPELINE_IO_MAT;
+       mat->pl_io.destroy = (pipeline_io_destroy)&mat_destroy;
+       mat->pl_io.type = PIPELINE_IO_MAT;
 
        BAT *matb = COLnew(0, tt, 1, TRANSIENT);
        if (!matb) {
@@ -167,8 +167,8 @@ PARTnew(Client cntxt, MalBlkPtr mb, MalS
                throw(MAL, "part.new", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        }
        MT_lock_init(&part->l, "partition");
-       part->s.destroy = (pipeline_io_destroy)&part_destroy;
-       part->s.type = PIPELINE_IO_PART;
+       part->pl_io.destroy = (pipeline_io_destroy)&part_destroy;
+       part->pl_io.type = PIPELINE_IO_PART;
 
        BAT *partb = COLnew(0, TYPE_oid, 100000 /* need estimate? */, 
TRANSIENT);
        if (!partb) {
@@ -227,7 +227,7 @@ PARTpartition(Client ctx, bat *pos, cons
                throw(MAL, "part.partition", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
        part_t *pt = (part_t*)p->pl_io;
-       assert(pt->s.type == PIPELINE_IO_PART);
+       assert(pt->pl_io.type == PIPELINE_IO_PART);
        assert(pt->nr == (int)BATcount(g));
        BAT *posb = COLnew(0, TYPE_lng, pt->nr, TRANSIENT);
        if (!posb) {
@@ -359,7 +359,7 @@ MATproject(Client ctx, bat *mat, const b
        lng *lp = (lng*)Tloc(l, 0);
        lng *grp = (lng*)Tloc(g, 0);
        mat_t *mt = (mat_t*)m->pl_io;
-       assert(mt->s.type == PIPELINE_IO_MAT);
+       assert(mt->pl_io.type == PIPELINE_IO_MAT);
        assert(mt->nr == (int)BATcount(p));
        assert(mt->nr == (int)BATcount(l));
        assert(BATcount(g) == BATcount(d));
@@ -459,7 +459,7 @@ MATfetch(Client ctx, bat *res, const bat
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to