LCOV - code coverage report
Current view: top level - monetdb5/optimizer - opt_candidates.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 47 47 100.0 %
Date: 2021-10-13 02:24:04 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : /*
      10             :  * Mark the production and use of candidate lists.
      11             :  */
      12             : 
      13             : #include "monetdb_config.h"
      14             : #include "mal_instruction.h"
      15             : #include "opt_candidates.h"
      16             : 
      17             : str
      18      353093 : OPTcandidatesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
      19             : {
      20             :         int i;
      21             :         InstrPtr p;
      22             :         str msg= MAL_SUCCEED;
      23             : 
      24             :         (void) cntxt;
      25             :         (void) stk;             /* to fool compilers */
      26    23116200 :         for (i = 0; i < mb->stop; i++) {
      27    22763107 :                 p = getInstrPtr(mb,i);
      28    22763107 :                 if( p->token == ASSIGNsymbol) {
      29             :                         int j;
      30      134494 :                         for (j = 0; j < p->retc && j + p->retc < p->argc; j++)
      31        4906 :                                 if (isVarCList(mb,getArg(p,p->retc + j)))
      32          29 :                                         setVarCList(mb,getArg(p,j));
      33             :                 }
      34    22763107 :                 if( getModuleId(p) == sqlRef){
      35     3175994 :                         if(getFunctionId(p) == tidRef)
      36      264845 :                                 setVarCList(mb,getArg(p,0));
      37     2911149 :                         else if(getFunctionId(p) == subdeltaRef)
      38       59129 :                                 setVarCList(mb,getArg(p,0));
      39             :                 }
      40    19587113 :                 else if( getModuleId(p) == algebraRef ){
      41     3155780 :                         if(getFunctionId(p) == selectRef || getFunctionId(p) == thetaselectRef)
      42      435872 :                                 setVarCList(mb,getArg(p,0));
      43     2719908 :                         else if(getFunctionId(p) == likeselectRef)
      44        1286 :                                 setVarCList(mb,getArg(p,0));
      45     2718622 :                         else if(getFunctionId(p) == intersectRef || getFunctionId(p) == differenceRef )
      46       93585 :                                 setVarCList(mb,getArg(p,0));
      47     2625037 :                         else if(getFunctionId(p) == uniqueRef )
      48          58 :                                 setVarCList(mb,getArg(p,0));
      49     2624979 :                         else if(getFunctionId(p) == firstnRef )
      50         990 :                                 setVarCList(mb,getArg(p,0));
      51     2623989 :                         else if(getFunctionId(p) == subsliceRef )
      52        1176 :                                 setVarCList(mb,getArg(p,0));
      53     2622813 :                         else if (getFunctionId(p) == projectionRef &&
      54     1698628 :                                          isVarCList(mb,getArg(p,p->retc + 0)) &&
      55      921257 :                                          isVarCList(mb,getArg(p,p->retc + 1)))
      56       85171 :                                 setVarCList(mb,getArg(p,0));
      57             :                 }
      58    16431333 :                 else if( getModuleId(p) == generatorRef){
      59         317 :                         if(getFunctionId(p) == selectRef || getFunctionId(p) == thetaselectRef)
      60          27 :                                 setVarCList(mb,getArg(p,0));
      61             :                 }
      62    16431016 :                 else if (getModuleId(p) == sampleRef) {
      63          21 :                         if (getFunctionId(p) == subuniformRef)
      64          21 :                                 setVarCList(mb, getArg(p, 0));
      65             :                 }
      66    16430995 :                 else if (getModuleId(p) == groupRef && p->retc > 1) {
      67       67938 :                         if (getFunctionId(p) == subgroupRef || getFunctionId(p) == subgroupdoneRef ||
      68       28808 :                                 getFunctionId(p) == groupRef || getFunctionId(p) == groupdoneRef)
      69       67938 :                                 setVarCList(mb, getArg(p, 1));
      70    16363057 :                 } else if (getModuleId(p) == batRef) {
      71     1006263 :                         if (getFunctionId(p) == mergecandRef ||
      72      925127 :                                 getFunctionId(p) == intersectcandRef ||
      73      925127 :                                 getFunctionId(p) == diffcandRef ||
      74      925127 :                                 getFunctionId(p) == mirrorRef)
      75      157420 :                                 setVarCList(mb,getArg(p,0));
      76             :                 }
      77             :         }
      78             : 
      79             :         /* Defense line against incorrect plans */
      80             :         /* plan remains unaffected */
      81             :         // msg = chkTypes(cntxt->usermodule, mb, FALSE);
      82             :         // if( ms== MAL_SUCCEED)
      83             :         //      msg = chkFlow(mb);
      84             :         // if( ms== MAL_SUCCEED)
      85             :         //      msg = chkDeclarations(mb);
      86             :         /* keep actions taken as a fake argument*/
      87      353093 :         (void) pushInt(mb, pci, 1);
      88      353093 :         return msg;
      89             : }

Generated by: LCOV version 1.14