Changeset: 1fe774d6f2a6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1fe774d6f2a6
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_parser.c
        monetdb5/mal/mal_type.h
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/mat.h
        monetdb5/modules/mal/mat.mal
        monetdb5/optimizer/opt_multiplex.c
        sql/backends/monet5/sql_gencode.c
Branch: default
Log Message:

Minor textual
All newBATtype calls only work on TYPE_oid head.
To be replaced at some point by column signatures.


diffs (truncated from 318 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
@@ -1363,7 +1363,6 @@ str MATpack2(Client cntxt, MalBlkPtr mb,
 str MATpackIncrement(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 str MATpackSlice(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 str MATpackValues(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
-str MATprint(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 str MATproject(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str MATsort(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str MATsortReverse(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -288,17 +288,15 @@ static void replaceTypeVar(MalBlkPtr mb,
        for(i=0;i<p->argc; i++)
        if( isPolymorphic(x= getArgType(mb,p,i))) {
                if( isaBatType(x)){
-                       int head,tail;
+                       int tail;
                        int tx;
-                       head = TYPE_oid;
                        tail = getColumnType(x);
                        tx = getColumnIndex(x);
-                       head = TYPE_oid;
                        if(v && tx == v && tail == TYPE_any){
                            tx= 0;
                            tail = t;
                        }
-                       y= newBatType(head,tail);
+                       y= newBatType(TYPE_oid,tail);
                        setAnyColumnIndex(y,tx);
                        setArgType(mb,p,i,y);
 #ifdef DEBUG_MAL_FCN
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -689,8 +689,7 @@ parseTypeId(Client cntxt, int defaultTyp
                                parseError(cntxt, "':oid' expected\n");
                                return i;
                        }
-               } else
-                       ht = TYPE_any;
+               } 
 
                if (currChar(cntxt) != ',') {
                        parseError(cntxt, "',' expected\n");
@@ -704,7 +703,7 @@ parseTypeId(Client cntxt, int defaultTyp
                } else
                        tt = TYPE_any;
 
-               i = newBatType(ht, tt);
+               i = newBatType(TYPE_oid, tt);
                if (kh > 0)
                        setAnyHeadIndex(i, kh);
                if (kt > 0)
diff --git a/monetdb5/mal/mal_type.h b/monetdb5/mal/mal_type.h
--- a/monetdb5/mal/mal_type.h
+++ b/monetdb5/mal/mal_type.h
@@ -16,7 +16,7 @@
 #define TMPMARKER '_'
 #define REFMARKER 'X'
 
-#define newBatType(H,T)  (1<<16 | (((H & 0377) <<8) | (T & 0377) ))
+#define newBatType(H,T)  (1<<16 | (((TYPE_oid & 0377) <<8) | (T & 0377) ))
 #define isaBatType(X)   ((1<<16) & (X) && (X)!= TYPE_any)
 #define setAnyHeadIndex(X,I) X |= ((I & 017)<<22);
 #define isAnyExpression(X) ((X) >> 17)
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
@@ -85,15 +85,11 @@ MATpackInternal(Client cntxt, MalBlkPtr 
        for (i = 1; i < p->argc; i++) {
                bat bid = stk->stk[getArg(p,i)].val.bval;
                b = BBPquickdesc(abs(bid),FALSE);
-               if (b && bid < 0)
-                       b = BATmirror(b);
                if( b ){
-                       assert(BAThdense(b));
-                       if (tt == TYPE_any){
+                       if (tt == TYPE_any)
                                tt = b->ttype;
-                       }
-                       if (!tt && tt != b->ttype)
-                               tt = b->ttype;
+                       if (tt != b->ttype)
+                               throw(MAL, "mat.pack", "incompatible 
arguments");
                        cap += BATcount(b);
                }
        }
@@ -117,7 +113,6 @@ MATpackInternal(Client cntxt, MalBlkPtr 
                        BBPunfix(b->batCacheid);
                }
        }
-       assert(!bn->H->nil || !bn->H->nonil);
        assert(!bn->T->nil || !bn->T->nonil);
        BATsettrivprop(bn);
        BATderiveProps(bn,FALSE);
@@ -289,7 +284,7 @@ MATpackSliceInternal(MalBlkPtr mb, MalSt
        bn = BATnew(TYPE_void, tt, cnt, TRANSIENT);
        if (bn == NULL)
                throw(MAL, "mat.packSlice", MAL_MALLOC_FAIL);
-       /* must set seqbase or else BATins will not materialize column */
+       /* must set seqbase else BATins will not materialize column */
        BATseqbase(bn, 0);
        if (tt == TYPE_void)
                BATseqbase(BATmirror(bn), 0);
@@ -515,13 +510,6 @@ MATpackSlice(Client cntxt, MalBlkPtr mb,
 
 
 str
-MATprint(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
-{
-       (void) cntxt; (void) mb; (void) stk; (void) p;
-       return MAL_SUCCEED;
-}
-
-str
 MATinfo(bat *ret, str *grp, str *elm){
        (void) grp; (void) elm;
        *ret = bat_nil;
diff --git a/monetdb5/modules/mal/mat.h b/monetdb5/modules/mal/mat.h
--- a/monetdb5/modules/mal/mat.h
+++ b/monetdb5/modules/mal/mat.h
@@ -33,7 +33,6 @@ mat_export str MATpackSlice(Client cntxt
 mat_export str MATnewIterator(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
 mat_export str MAThasMoreElements(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
 mat_export str MATinfo(bat *ret, str *grp, str *elm);
-mat_export str MATprint(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 mat_export str MATproject(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 mat_export str MATsortReverse(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 mat_export str MATsort(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
diff --git a/monetdb5/modules/mal/mat.mal b/monetdb5/modules/mal/mat.mal
--- a/monetdb5/modules/mal/mat.mal
+++ b/monetdb5/modules/mal/mat.mal
@@ -61,9 +61,6 @@ pattern sortReverse(b:bat[:oid,:any_2]..
 address MATsortReverse
 comment "Returns a BAT copy sorted on the tail column.";
 
-pattern print(b:bat[:oid,:any_2]...):void
-address MATprint;
-
 pattern newIterator(grp:bat[:oid,:any_2]...):bat[:oid,:any_2]
 address MATnewIterator
 comment "Create an iterator over a MAT";
diff --git a/monetdb5/optimizer/opt_multiplex.c 
b/monetdb5/optimizer/opt_multiplex.c
--- a/monetdb5/optimizer/opt_multiplex.c
+++ b/monetdb5/optimizer/opt_multiplex.c
@@ -38,13 +38,12 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
        str mod, fcn;
        int *alias, *resB;
        InstrPtr q;
-       int ht, tt;
+       int tt;
        int bat = (getModuleId(pci) == batmalRef) ;
 
        (void) cntxt;
        (void) stk;
        for (i = 0; i < pci->retc; i++) {
-               ht = TYPE_oid;
                tt = getColumnType(getArgType(mb, pci, i));
                if (tt== TYPE_any)
                        throw(MAL, "optimizer.multiplex", "Target tail type is 
missing");
@@ -98,11 +97,10 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
                q = newFcnCall(mb, batRef, newRef);
                resB[i] = getArg(q, 0);
 
-               ht = TYPE_oid;
                tt = getColumnType(getArgType(mb, pci, i));
 
-               setVarType(mb, getArg(q, 0), newBatType(ht, tt));
-               q = pushType(mb, q, ht);
+               setVarType(mb, getArg(q, 0), newBatType(TYPE_oid, tt));
+               q = pushType(mb, q, TYPE_oid);
                q = pushType(mb, q, tt);
        }
 
@@ -131,9 +129,8 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
        for (i = 0; i < pci->retc; i++) {
                int nvar = 0;
                if (bat) {
-                       ht = TYPE_oid;
                        tt = getColumnType(getArgType(mb, pci, i));
-                       nvar = newTmpVariable(mb, newBatType(ht, tt));
+                       nvar = newTmpVariable(mb, newBatType(TYPE_oid, tt));
                } else {
                        nvar = newTmpVariable(mb, TYPE_any);
                }
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -956,7 +956,6 @@ static int
                        s->nr = getDestVar(q);
                } break;
                case st_single:{
-                       int ht = TYPE_oid;
                        int tt = s->op4.typeval.type->localtype;
                        int val = _dumpstmt(sql, mb, s->op1);
 
@@ -965,22 +964,21 @@ static int
                        q = newStmt1(mb, sqlRef, "single");
                        if (q == NULL)
                                return -1;
-                       setVarType(mb, getArg(q, 0), newBatType(ht, tt));
+                       setVarType(mb, getArg(q, 0), newBatType(TYPE_oid, tt));
                        q = pushArgument(mb, q, val);
                        if (q == NULL)
                                return -1;
                        s->nr = getDestVar(q);
                } break;
                case st_temp:{
-                       int ht = TYPE_oid;
                        int tt = s->op4.typeval.type->localtype;
 
                        q = newStmt1(mb, batRef, "new");
                        if (q == NULL)
                                return -1;
-                       setVarType(mb, getArg(q, 0), newBatType(ht, tt));
+                       setVarType(mb, getArg(q, 0), newBatType(TYPE_oid, tt));
                        setVarUDFtype(mb, getArg(q, 0));
-                       q = pushType(mb, q, ht);
+                       q = pushType(mb, q, TYPE_oid);
                        q = pushType(mb, q, tt);
                        if (q == NULL)
                                return -1;
@@ -988,14 +986,13 @@ static int
                        s->nr = getDestVar(q);
                } break;
                case st_tid:{
-                       int ht = TYPE_oid;
                        int tt = TYPE_oid;
                        sql_table *t = s->op4.tval;
 
                        q = newStmt1(mb, sqlRef, "tid");
                        if (q == NULL)
                                return -1;
-                       setVarType(mb, getArg(q, 0), newBatType(ht, tt));
+                       setVarType(mb, getArg(q, 0), newBatType(TYPE_oid, tt));
                        setVarUDFtype(mb, getArg(q, 0));
                        q = pushArgument(mb, q, sql->mvc_var);
                        q = pushSchema(mb, q, t);
@@ -1006,7 +1003,6 @@ static int
                }
                        break;
                case st_bat:{
-                       int ht = TYPE_oid;
                        int tt = s->op4.cval->type.type->localtype;
                        sql_table *t = s->op4.cval->t;
 
@@ -1014,9 +1010,9 @@ static int
                        if (q == NULL)
                                return -1;
                        if (s->flag == RD_UPD_ID) {
-                               q = pushReturn(mb, q, newTmpVariable(mb, 
newBatType(ht, tt)));
+                               q = pushReturn(mb, q, newTmpVariable(mb, 
newBatType(TYPE_oid, tt)));
                        } else {
-                               setVarType(mb, getArg(q, 0), newBatType(ht, 
tt));
+                               setVarType(mb, getArg(q, 0), 
newBatType(TYPE_oid, tt));
                                setVarUDFtype(mb, getArg(q, 0));
                        }
                        q = pushArgument(mb, q, sql->mvc_var);
@@ -1035,7 +1031,6 @@ static int
                }
                        break;
                case st_idxbat:{
-                       int ht = TYPE_oid;
                        int tt = tail_type(s)->type->localtype;
                        sql_table *t = s->op4.idxval->t;
 
@@ -1043,9 +1038,9 @@ static int
                        if (q == NULL)
                                return -1;
                        if (s->flag == RD_UPD_ID) {
-                               q = pushReturn(mb, q, newTmpVariable(mb, 
newBatType(ht, tt)));
+                               q = pushReturn(mb, q, newTmpVariable(mb, 
newBatType(TYPE_oid, tt)));
                        } else {
-                               setVarType(mb, getArg(q, 0), newBatType(ht, 
tt));
+                               setVarType(mb, getArg(q, 0), 
newBatType(TYPE_oid, tt));
                                setVarUDFtype(mb, getArg(q, 0));
                        }
 
@@ -1106,16 +1101,15 @@ static int
                        assert(s->nrcols);
                        if (s->nrcols == 0) {
                                int k;
-                               int ht = TYPE_oid;
                                int tt = tail_type(s->op1)->type->localtype;
 
                                assert(0);
                                q = newStmt1(mb, batRef, "new");
                                if (q == NULL)
                                        return -1;
-                               setVarType(mb, getArg(q, 0), newBatType(ht, 
tt));
+                               setVarType(mb, getArg(q, 0), 
newBatType(TYPE_oid, tt));
                                setVarUDFtype(mb, getArg(q, 0));
-                               q = pushType(mb, q, ht);
+                               q = pushType(mb, q, TYPE_oid);
                                q = pushType(mb, q, tt);
                                if (q == NULL)
                                        return -1;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to