Changeset: e07dc01c7ed2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e07dc01c7ed2
Modified Files:
        monetdb5/mal/mal_listing.c
        monetdb5/mal/mal_profiler.c
        monetdb5/optimizer/opt_profiler.c
Branch: Dec2016
Log Message:

Propagate the origin
For performance profiling it helps to have access to the
schema.table.column alias for a variable.
It is emitted as variable property.


diffs (88 lines):

diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c
--- a/monetdb5/mal/mal_listing.c
+++ b/monetdb5/mal/mal_listing.c
@@ -408,9 +408,7 @@ shortRenderingTerm(MalBlkPtr mb, MalStkP
        } else {
                val = &stk->stk[varid];
                VALformat(&cv, val);
-               nme = getSTC(mb, varid);
-               if( nme[0]== 0) 
-                       nme = getVarName(mb, varid);
+               nme = getVarName(mb, varid);
                if ( isaBatType(getArgType(mb,p,idx))){
                        b = BBPquickdesc(stk->stk[varid].val.bval,TRUE);
                        snprintf(s,BUFSIZ,"%s["BUNFMT"]" ,nme, b?BATcount(b):0);
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -271,6 +271,9 @@ This information can be used to determin
                                logadd("{");
                                logadd("\"index\":\"%d\",%s", j,pret);
                                logadd("\"name\":\"%s\",%s", getVarName(mb, 
getArg(pci,j)), pret);
+                               if( mb->var[getArg(pci,j)]->stc[0]){
+                                       logadd("\"alias\":\"%s\",%s", 
mb->var[getArg(pci,j)]->stc, pret);
+                               }
                                if( isaBatType(tpe) ){
                                        BAT *d= BATdescriptor( bid = 
stk->stk[getArg(pci,j)].val.bval);
                                        tname = getTypeName(getBatType(tpe));
diff --git a/monetdb5/optimizer/opt_profiler.c 
b/monetdb5/optimizer/opt_profiler.c
--- a/monetdb5/optimizer/opt_profiler.c
+++ b/monetdb5/optimizer/opt_profiler.c
@@ -67,7 +67,7 @@ OPTprofilerImplementation(Client cntxt, 
                        continue;
                if ( getModuleId(p) == NULL || getFunctionId(p) == NULL)
                        continue;
-               if( getModuleId(p)== sqlRef && getFunctionId(p)== bindRef){
+               if( getModuleId(p)== sqlRef && (getFunctionId(p)== bindRef || 
getFunctionId(p) == bindidxRef)){
                        // we know the arguments are constant
                        snprintf(getSTC(mb,getArg(p,0)),  2 * IDLENGTH, 
"%s.%s.%s", 
                                getVarConstant(mb, getArg(p,p->retc 
+1)).val.sval,
@@ -80,6 +80,12 @@ OPTprofilerImplementation(Client cntxt, 
                                getVarConstant(mb, getArg(p,2)).val.sval,
                                getVarConstant(mb, getArg(p,3)).val.sval);
                } else
+               if( getModuleId(p)== batRef && (getFunctionId(p)== deltaRef || 
getFunctionId(p) == subdeltaRef)){
+                       // inherit property of first argument
+                       v = getSTC(mb,getArg(p,1));
+                       if(v != NULL)
+                               strncpy(getSTC(mb,getArg(p,0)),v, 2 * IDLENGTH);
+               } else
                if( getModuleId(p)== sqlRef && getFunctionId(p)== 
projectdeltaRef){
                        // inherit property of first argument
                        v = getSTC(mb,getArg(p,1));
@@ -92,11 +98,32 @@ OPTprofilerImplementation(Client cntxt, 
                        if( v != NULL)
                                strncpy(getSTC(mb,getArg(p,0)),v, 2 * IDLENGTH);
                } else
-               if( getModuleId(p)== algebraRef && getFunctionId(p)== 
subjoinRef){
-                       // inherit property of last argument
-                       v = getSTC(mb,getArg(p,p->argc-1) );
+               if( getModuleId(p)== algebraRef && (getFunctionId(p)== 
subselectRef || getFunctionId(p) == thetasubselectRef)){
+                       // inherit property of first argument
+                       v = getSTC(mb,getArg(p,p->retc));
                        if( v != NULL)
                                strncpy(getSTC(mb,getArg(p,0)),v, 2 * IDLENGTH);
+               } else
+               if( getModuleId(p)== algebraRef && (getFunctionId(p)== 
likesubselectRef || getFunctionId(p) == ilikesubselectRef)){
+                       // inherit property of first argument
+                       v = getSTC(mb,getArg(p,p->retc));
+                       if( v != NULL)
+                               strncpy(getSTC(mb,getArg(p,0)),v, 2 * IDLENGTH);
+               } else
+               if( getModuleId(p)== algebraRef && 
+                       ( getFunctionId(p)== subjoinRef ||
+                         getFunctionId(p) == subleftjoinRef ||
+                         getFunctionId(p) == subthetajoinRef ||
+                         getFunctionId(p) == subantijoinRef ||
+                         getFunctionId(p) == subbandjoinRef ||
+                         getFunctionId(p) == subrangejoinRef )){
+                       // inherit property of last argument
+                       v = getSTC(mb,getArg(p,p->retc) );
+                       if( v != NULL)
+                               strncpy(getSTC(mb,getArg(p,0)),v, 2 * IDLENGTH);
+                       v = getSTC(mb,getArg(p,p->retc + 1 ) );
+                       if( v != NULL)
+                               strncpy(getSTC(mb,getArg(p,1)),v, 2 * IDLENGTH);
                } 
        }
     /* Defense line against incorrect plans */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to