Changeset: 6b3a4382a548 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6b3a4382a548
Modified Files:
monetdb5/optimizer/opt_costModel.c
Branch: headless
Log Message:
restored original cost model functionality that got lost during .mx to .c
conversion
found by optimized compilation:
monetdb5/optimizer/opt_costModel.c:119:13: error: 'c2' may be used
uninitialized in this function
diffs (80 lines):
diff --git a/monetdb5/optimizer/opt_costModel.c
b/monetdb5/optimizer/opt_costModel.c
--- a/monetdb5/optimizer/opt_costModel.c
+++ b/monetdb5/optimizer/opt_costModel.c
@@ -68,18 +68,18 @@
#define newRows(A1,A2,A3,A4) { \
ValRecord v; \
\
- c1 = getVarRows(mb, getArg(p,A1)); \
- c2 = getVarRows(mb, getArg(p,A2)); \
+ c1 = getVarRows(mb, getArg(p,(A1))); \
+ c2 = getVarRows(mb, getArg(p,(A2))); \
if (c1 == -1 || c2 == -1) \
continue; \
k = (A3); \
- varSetProp(mb, getArg(p,A4), rowsProp, op_eq,
VALset(&v,TYPE_wrd,&k)); \
+ varSetProp(mb, getArg(p,(A4)), rowsProp, op_eq,
VALset(&v,TYPE_wrd,&k)); \
OPTDEBUGcostModel { \
mnstr_printf(cntxt->fdout,"COST into : " SSZFMT
"\n",k); \
printInstruction(cntxt->fdout,mb,0,p,0); \
} }
-#define newRows1(A1,A2) newRows(A1,A1,A2,0)
-#define newRows2(A1) newRows(1,2,A1,0)
+#define newRows1(A1,A2) newRows((A1),(A1),(A2),0)
+#define newRows2(A1) newRows(1,2,(A1),0)
/*
* SQL specific back propagation of table size may be needed to avoid
* the empty-set optimizer to through away a column we need.
@@ -143,29 +143,22 @@
newRows1(1, c1)
} else if(getFunctionId(p) == unionRef ||
getFunctionId(p) == kunionRef) {
- c1= c1+c2;
- newRows2(c1)
+ newRows2(c1+c2)
} else if (getFunctionId(p)== kdifferenceRef) {
- c1=(c1==0?0:c2==0?c1: c1 - c2 < 0 ? 1 : c1 -
c2+1);
- newRows2(c1);
+ newRows2(c1==0?0:c2==0?c1: c1 - c2 < 0 ? 1 : c1
- c2+1)
} else if (getFunctionId(p) == joinRef ) {
/* assume 1-1 joins */
- c1= (c1 < c2 ? c1 : c2);
- newRows2(c1);
+ newRows2(c1 < c2 ? c1 : c2)
} else if (getFunctionId(p) == semijoinRef ) {
/* assume 1-1 semijoins */
- c1= (c1 < c2? c1 : c2);
- newRows2(c1);
+ newRows2(c1 < c2? c1 : c2)
} else if (getFunctionId(p) == selectRef ||
getFunctionId(p) == uselectRef) {
- c1 = c1 > 100 ? c1 / 2 +1: c1;
- newRows1(1, c1);
+ newRows1(1, c1 > 100 ? c1 / 2 +1: c1)
} else if (getFunctionId(p) == crossRef) {
- c1= ((log((double) c1) + log((double) c2) >
log(INT_MAX) ? INT_MAX : c1 * c2 +1));
- newRows2(c1);
+ newRows2((log((double) c1) + log((double) c2) >
log(INT_MAX) ? INT_MAX : c1 * c2 +1))
} else if (getFunctionId(p) == tuniqueRef ) {
- c1= c1 < 50 ? c1 : c1 / 10+1;
- newRows1(1, c1);
+ newRows1(1, c1 < 50 ? c1 : c1 / 10+1)
}
} else if (getModuleId(p) == batcalcRef) {
if( isaColType(getArgType(mb,p,1)) )
@@ -194,13 +187,11 @@
* an initially empty insertion column.
*/
if( isaColType(getArgType(mb,p,2)) ){
- c1= c1+c2 +1;
- newRows(1,2, c1 ,1)
+ newRows(1,2, c1 + c2+1,1)
OPTbackpropagate(mb,i,getArg(p,1));
} else {
/* insert scalars */
- c1= c1+1;
- newRows(1,1, c1 ,1)
+ newRows(1,1, c1 +1,1)
OPTbackpropagate(mb,i,getArg(p,1));
}
} else if (getFunctionId(p) == deleteRef){
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list