Changeset: a64198b89186 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a64198b89186
Modified Files:
        monetdb5/optimizer/opt_dict.c
        sql/backends/monet5/dict.c
Branch: dict
Log Message:

small fix on the join renumbering

small fix on OPTdict: set result type of map operation correctly


diffs (101 lines):

diff --git a/monetdb5/optimizer/opt_dict.c b/monetdb5/optimizer/opt_dict.c
--- a/monetdb5/optimizer/opt_dict.c
+++ b/monetdb5/optimizer/opt_dict.c
@@ -172,7 +172,7 @@ OPTdictImplementation(Client cntxt, MalB
                                         * v1 = batcalc.-(1, u)
                                         * dict.decompress(o, v1) */
                                        InstrPtr r = copyInstruction(p);
-                                       int tpe = getVarType(mb, 
vardictvalue[k]);
+                                       int tpe = getVarType(mb, getArg(p,0));
                                        int l = getArg(r, 0);
                                        getArg(r, 0) = newTmpVariable(mb, tpe);
                                        getArg(r, j) = vardictvalue[k];
diff --git a/sql/backends/monet5/dict.c b/sql/backends/monet5/dict.c
--- a/sql/backends/monet5/dict.c
+++ b/sql/backends/monet5/dict.c
@@ -203,22 +203,35 @@ DICTconvert(Client cntxt, MalBlkPtr mb, 
        BATiter oi = bat_iterator(o);
        if (rt == TYPE_bte) {
                unsigned char *rp = Tloc(b, 0);
-               oid *op = Tloc(o, 0);
-               BATloop(o, p, q) {
-                       rp[p] = op[p];
+               if (o->ttype == TYPE_void) {
+                       BATloop(o, p, q) {
+                               rp[p] = p+o->T.seq;
+                       }
+               } else {
+                       oid *op = Tloc(o, 0);
+                       BATloop(o, p, q) {
+                               rp[p] = op[p];
+                       }
                }
        } else if (rt == TYPE_sht) {
                unsigned short *rp = Tloc(b, 0);
-               oid *op = Tloc(o, 0);
-               BATloop(o, p, q) {
-                       rp[p] = op[p];
+               if (o->ttype == TYPE_void) {
+                       BATloop(o, p, q) {
+                               rp[p] = p+o->T.seq;
+                       }
+               } else {
+                       oid *op = Tloc(o, 0);
+                       BATloop(o, p, q) {
+                               rp[p] = op[p];
+                       }
                }
        } else {
                assert(0);
        }
        bat_iterator_end(&oi);
        BATsetcount(b, BATcount(o));
-       /* TODO correct props and set min/max offset */
+       b->T.sorted = o->T.sorted;
+       b->T.key = o->T.key;
        BBPkeepref(*r = b->batCacheid);
        bat_destroy(o);
        return MAL_SUCCEED;
@@ -269,31 +282,19 @@ DICTrenumber( BAT *o, BAT *lc, BAT *rc, 
                BAT *nrc = COLnew(0, rc->ttype, offcnt, TRANSIENT);
 
                /* create map with holes filled in */
-               if (o->ttype == TYPE_bte) {
-                       bte *op = Tloc(nrc, 0);
-                       unsigned char *ip = Tloc(rc, 0);
-                       unsigned char *lp = Tloc(lc, 0);
-                       for(BUN i = 0, j = 0; i<offcnt; i++) {
-                               if (lp[j] > i) {
-                                       op[i] = offcnt;
-                               } else {
-                                       op[i] = ip[j++];
-                               }
+               oid *op = Tloc(nrc, 0);
+               oid *ip = Tloc(rc, 0);
+               unsigned char *lp = Tloc(lc, 0);
+               for(BUN i = 0, j = 0; i<offcnt; i++) {
+                       if (lp[j] > i) {
+                               op[i] = offcnt;
+                       } else {
+                               op[i] = ip[j++];
                        }
-               } else if (o->ttype == TYPE_sht) {
-                       sht *op = Tloc(nrc, 0);
-                       unsigned short *ip = Tloc(rc, 0);
-                       unsigned short *lp = Tloc(lc, 0);
-                       for(BUN i = 0, j = 0; i<offcnt; i++) {
-                               if (lp[j] > i) {
-                                       op[i] = offcnt;
-                               } else {
-                                       op[i] = ip[j++];
-                               }
-                       }
-               } else {
-                       assert(0);
                }
+               BATsetcount(nrc, offcnt);
+               BATnegateprops(nrc);
+               nrc->tkey = rc->tkey;
                if (orc != rc)
                        bat_destroy(rc);
                rc = nrc;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to