Changeset: 1196aa5f895b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1196aa5f895b
Modified Files:
        monetdb5/modules/mal/properties.c
        monetdb5/optimizer/opt_properties.c
        sql/backends/monet5/sql_optimizer.c
Branch: types
Log Message:

Harmonize the downcasting types.


diffs (84 lines):

diff --git a/monetdb5/modules/mal/properties.c 
b/monetdb5/modules/mal/properties.c
--- a/monetdb5/modules/mal/properties.c
+++ b/monetdb5/modules/mal/properties.c
@@ -48,10 +48,16 @@ PROPbind(Client cntxt, MalBlkPtr mb, Mal
 #include "mel.h"
 mel_func properties_init_funcs[] = {
  pattern("properties", "bind", PROPbind, false, "Retrieve actual properties 
from a BAT", args(1,3,  arg("",void),batargany("",1),arg("min",int))),
- pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  
arg("",void),batargany("",1),arg("min",bte),arg("max",bte),arg("cnt",lng) )),
- pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  
arg("",void),batargany("",1),arg("min",sht),arg("max",sht),arg("cnt",lng) )),
- pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  
arg("",void),batargany("",1),arg("min",int),arg("max",int),arg("cnt",lng) )),
- pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  
arg("",void),batargany("",1),arg("min",lng),arg("max",lng),arg("cnt",lng) )),
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  arg("",void),batargany("",1),arg("cnt",lng), 
arg("min",bte),arg("max",bte))),
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  arg("",void),batargany("",1), arg("cnt",lng), 
arg("min",sht),arg("max",sht))),
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  
arg("",void),batargany("",1),arg("cnt",lng),arg("min",int),arg("max",int))),
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  arg("",void),batargany("",1),arg("cnt",lng), 
arg("min",lng),arg("max",lng))),
+#ifdef HAVE_HGE
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  arg("",void),batargany("",1),arg("cnt",lng), 
arg("min",hge),arg("max",hge))),
+#endif
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  arg("",void),batargany("",1),arg("cnt",lng), 
arg("min",flt),arg("max",flt))),
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  arg("",void),batargany("",1),arg("cnt",lng), 
arg("min",dbl),arg("max",dbl))),
+ pattern("properties", "info", PROPinfo, false, "Retrieve actual properties 
from a BAT", args(1,5,  arg("",void),batargany("",1),arg("cnt",lng), 
arg("min",oid),arg("max",oid))),
  { .imp=NULL }
 };
 #include "mal_import.h"
diff --git a/monetdb5/optimizer/opt_properties.c 
b/monetdb5/optimizer/opt_properties.c
--- a/monetdb5/optimizer/opt_properties.c
+++ b/monetdb5/optimizer/opt_properties.c
@@ -19,26 +19,27 @@
 #define properties(TPE) \
        val =  BATmax_skipnil(bn, (void*) (&vmax.val.TPE), 1);\
        vmax.vtype = basetype;\
-       restype =scaledown(&vmax);\
+       r1 =scaledown(&vmax);\
        if( val != &vmax.val.TPE){\
                assert(0);\
                /* error */\
        }\
        val =  BATmin_skipnil(bn, (void*) (&vmin.val.TPE), 1);\
        vmin.vtype = basetype;\
-       restype =scaledown(&vmin);\
+       r2 =scaledown(&vmin);\
        if( val != &vmin.val.TPE){\
                /* error */\
-       }
+       } restype= MAX(r1,r2);\
+       vmin.vtype = vmax.vtype = restype;
 
 
 #define keeparound(T, TPE)\
        q = newStmt(mb, propertiesRef, infoRef);\
        setArgType(mb, q, 0, TYPE_void);\
        q = pushArgument(mb, q, getArg(pci,1));\
+       q = pushLng(mb, q, cnt);\
        q = push##T(mb, q, vmin.val.TPE);\
        q = push##T(mb, q, vmax.val.TPE);\
-       q = pushLng(mb, q, cnt);\
        q->token = REMsymbol
 
 
@@ -75,7 +76,7 @@ PROPstatistics(Client cntxt, MalBlkPtr m
        InstrPtr q;
        bat bid;
        BAT *b, *bn;
-       int restype = TYPE_any, basetype= TYPE_any;
+       int r1, r2, restype = TYPE_any, basetype= TYPE_any;
        ValRecord vmin, vmax;
        lng cnt = 0;
        ptr val;
diff --git a/sql/backends/monet5/sql_optimizer.c 
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -98,6 +98,12 @@ SQLgetSpace(mvc *m, MalBlkPtr mb, int pr
                                q = pushArgument(mb, q, getArg(p,0));
                                q = pushInt(mb, q, bid);
                                q->token = REMsymbol;
+                               if( p->retc == 2){
+                                       q = newStmt(mb, propertiesRef,  
bindRef);
+                                       q = pushArgument(mb, q, getArg(p,1));
+                                       q = pushInt(mb, q, bid);
+                                       q->token = REMsymbol;
+                               }
                        }
                        /* we have to sum the cost of all three components of a 
BAT */
                        if (c && isTable(c->t) && (lasttable == 0 || 
strcmp(lasttable,tname)==0)) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to