/ Check-in [4383cb68]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add missing VdbeCoverage() and VdbeCoverageNeverTaken() macros to window.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | exp-window-functions
Files: files | file ages | folders
SHA3-256: 4383cb68a1241768ddb3f180f8cbb9ea1638f8806210b10aac1384b8a7ecdca2
User & Date: dan 2018-06-27 20:24:59
Context
2018-06-30
19:12
Merge all changes from the weak-fallback branch except those related to the weak-fallback feature itself. check-in: aad718fb user: dan tags: exp-window-functions
2018-06-28
03:38
Introduce the concept of "weak fallback" in the parser. A weak fallback only occurs if a syntax error would result otherwise. check-in: c41d7079 user: drh tags: weak-fallback
2018-06-27
20:24
Add missing VdbeCoverage() and VdbeCoverageNeverTaken() macros to window.c. check-in: 4383cb68 user: dan tags: exp-window-functions
19:48
Avoid redundant ORDER BY operations when rewriting SELECT statements that contain window functions. check-in: 336de43a user: dan tags: exp-window-functions
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/window.c.

   950    950       "frame ending offset must be a non-negative integer"
   951    951     };
   952    952     Vdbe *v = sqlite3GetVdbe(pParse);
   953    953     int regZero = sqlite3GetTempReg(pParse);
   954    954     sqlite3VdbeAddOp2(v, OP_Integer, 0, regZero);
   955    955     sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2);
   956    956     sqlite3VdbeAddOp3(v, OP_Ge, regZero, sqlite3VdbeCurrentAddr(v)+2, reg);
          957  +  VdbeCoverage(v);
   957    958     sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_ERROR, OE_Abort);
   958    959     sqlite3VdbeAppendP4(v, (void*)azErr[bEnd], P4_STATIC);
   959    960     sqlite3ReleaseTempReg(pParse, regZero);
   960    961   }
   961    962   
   962    963   /*
   963    964   ** Return the number of arguments passed to the window-function associated
................................................................................
  1027   1028         if( bInverse==0 ){
  1028   1029           sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1, 1);
  1029   1030           sqlite3VdbeAddOp2(v, OP_SCopy, regArg, pWin->regApp);
  1030   1031           sqlite3VdbeAddOp3(v, OP_MakeRecord, pWin->regApp, 2, pWin->regApp+2);
  1031   1032           sqlite3VdbeAddOp2(v, OP_IdxInsert, pWin->csrApp, pWin->regApp+2);
  1032   1033         }else{
  1033   1034           sqlite3VdbeAddOp4Int(v, OP_SeekGE, pWin->csrApp, 0, regArg, 1);
         1035  +        VdbeCoverage(v);
  1034   1036           sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
  1035   1037           sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
  1036   1038         }
  1037   1039       }else if( pWin->regApp ){
  1038   1040         assert( pWin->pFunc->xSFunc==nth_valueStepFunc 
  1039   1041              || pWin->pFunc->xSFunc==first_valueStepFunc 
  1040   1042         );
................................................................................
  1052   1054           if( csr>0 ){
  1053   1055             regTmp = sqlite3GetTempReg(pParse);
  1054   1056             sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp);
  1055   1057           }else{
  1056   1058             regTmp = regArg + nArg;
  1057   1059           }
  1058   1060           addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
         1061  +        VdbeCoverage(v);
  1059   1062           if( csr>0 ){
  1060   1063             sqlite3ReleaseTempReg(pParse, regTmp);
  1061   1064           }
  1062   1065         }
  1063   1066         if( pWin->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
  1064   1067           CollSeq *pColl;
  1065   1068           pColl = sqlite3ExprNNCollSeq(pParse, pWin->pOwner->x.pList->a[0].pExpr);
................................................................................
  1085   1088   
  1086   1089     for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
  1087   1090       if( (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX) 
  1088   1091        && pWin->eStart!=TK_UNBOUNDED 
  1089   1092       ){
  1090   1093         sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);
  1091   1094         sqlite3VdbeAddOp1(v, OP_Last, pWin->csrApp);
         1095  +      VdbeCoverage(v);
  1092   1096         sqlite3VdbeAddOp3(v, OP_Column, pWin->csrApp, 0, pWin->regResult);
  1093   1097         sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
  1094   1098         if( bFinal ){
  1095   1099           sqlite3VdbeAddOp1(v, OP_ResetSorter, pWin->csrApp);
  1096   1100         }
  1097   1101       }else if( pWin->regApp ){
  1098   1102       }else{
................................................................................
  1152   1156       int nPart = pPart->nExpr;
  1153   1157       int regNewPart = reg + pMWin->nBufferCol;
  1154   1158       KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pPart, 0, 0);
  1155   1159   
  1156   1160       addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart,nPart);
  1157   1161       sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
  1158   1162       sqlite3VdbeAddOp3(v, OP_Jump, addr+2, addr+4, addr+2);
         1163  +    VdbeCoverage(v);
  1159   1164       sqlite3VdbeAddOp3(v, OP_Copy, regNewPart, pMWin->regPart, nPart-1);
  1160   1165       sqlite3VdbeAddOp2(v, OP_Gosub, regFlushPart, lblFlushPart);
  1161   1166     }
  1162   1167   
  1163   1168     /* Buffer the current row in the ephemeral table. */
  1164   1169     sqlite3VdbeAddOp2(v, OP_NewRowid, pMWin->iEphCsr, regRowid);
  1165   1170     sqlite3VdbeAddOp3(v, OP_Insert, pMWin->iEphCsr, regRecord, regRowid);
................................................................................
  1205   1210         if( pFunc->xSFunc==nth_valueStepFunc ){
  1206   1211           sqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+1,tmpReg);
  1207   1212         }else{
  1208   1213           sqlite3VdbeAddOp2(v, OP_Integer, 1, tmpReg);
  1209   1214         }
  1210   1215         sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg);
  1211   1216         sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg);
         1217  +      VdbeCoverage(v);
  1212   1218         sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg);
         1219  +      VdbeCoverage(v);
  1213   1220         sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
  1214   1221         sqlite3VdbeResolveLabel(v, lbl);
  1215   1222         sqlite3ReleaseTempReg(pParse, tmpReg);
  1216   1223       }
  1217   1224       else if( pFunc->xSFunc==leadStepFunc || pFunc->xSFunc==lagStepFunc ){
  1218   1225         int nArg = pWin->pOwner->x.pList->nExpr;
  1219   1226         int iEph = pMWin->iEphCsr;
................................................................................
  1235   1242           int tmpReg2 = sqlite3GetTempReg(pParse);
  1236   1243           sqlite3VdbeAddOp3(v, OP_Column, iEph, pWin->iArgCol+1, tmpReg2);
  1237   1244           sqlite3VdbeAddOp3(v, op, tmpReg2, tmpReg, tmpReg);
  1238   1245           sqlite3ReleaseTempReg(pParse, tmpReg2);
  1239   1246         }
  1240   1247   
  1241   1248         sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg);
         1249  +      VdbeCoverage(v);
  1242   1250         sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
  1243   1251         sqlite3VdbeResolveLabel(v, lbl);
  1244   1252         sqlite3ReleaseTempReg(pParse, tmpReg);
  1245   1253       }
  1246   1254     }
  1247   1255     sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub);
  1248   1256   }
................................................................................
  1271   1279     int regInvArg,                  /* Array of registers for xInverse args */
  1272   1280     int regInvSize                  /* Register containing size of partition */
  1273   1281   ){
  1274   1282     int addr;
  1275   1283     Vdbe *v = sqlite3GetVdbe(pParse);
  1276   1284     windowAggFinal(pParse, pMWin, 0);
  1277   1285     addr = sqlite3VdbeAddOp3(v, OP_IfPos, regCtr, sqlite3VdbeCurrentAddr(v)+2 ,1);
         1286  +  VdbeCoverage(v);
  1278   1287     sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);
  1279   1288     windowReturnOneRow(pParse, pMWin, regGosub, addrGosub);
  1280   1289     if( regInvArg ){
  1281   1290       windowAggStep(pParse, pMWin, pMWin->iEphCsr, 1, regInvArg, regInvSize);
  1282   1291     }
  1283   1292     sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, addr);
         1293  +  VdbeCoverage(v);
  1284   1294     sqlite3VdbeJumpHere(v, addr+1);   /* The OP_Goto */
  1285   1295   }
  1286   1296   
  1287   1297   /*
  1288   1298   ** Generate code to set the accumulator register for each window function
  1289   1299   ** in the linked list passed as the second argument to NULL. And perform
  1290   1300   ** any equivalent initialization required by any built-in window functions
................................................................................
  1485   1495     windowPartitionCache(pParse, p, pWInfo, regFlushPart, lblFlushPart, &regSize);
  1486   1496   
  1487   1497     addrGoto = sqlite3VdbeAddOp0(v, OP_Goto);
  1488   1498   
  1489   1499     /* Start of "flush_partition" */
  1490   1500     sqlite3VdbeResolveLabel(v, lblFlushPart);
  1491   1501     sqlite3VdbeAddOp2(v, OP_Once, 0, sqlite3VdbeCurrentAddr(v)+3);
         1502  +  VdbeCoverage(v);
  1492   1503     sqlite3VdbeAddOp2(v, OP_OpenDup, csrStart, pMWin->iEphCsr);
  1493   1504     sqlite3VdbeAddOp2(v, OP_OpenDup, csrEnd, pMWin->iEphCsr);
  1494   1505   
  1495   1506     /* If either regStart or regEnd are not non-negative integers, throw 
  1496   1507     ** an exception.  */
  1497   1508     if( pMWin->pStart ){
  1498   1509       sqlite3ExprCode(pParse, pMWin->pStart, regStart);
................................................................................
  1510   1521     **     regStart = regSize;
  1511   1522     **   }
  1512   1523     **   regEnd = regEnd - regStart;
  1513   1524     */
  1514   1525     if( pMWin->pEnd && pMWin->pStart && pMWin->eStart==TK_FOLLOWING ){
  1515   1526       assert( pMWin->eEnd==TK_FOLLOWING );
  1516   1527       sqlite3VdbeAddOp3(v, OP_Ge, regStart, sqlite3VdbeCurrentAddr(v)+2, regEnd);
         1528  +    VdbeCoverage(v);
  1517   1529       sqlite3VdbeAddOp2(v, OP_Copy, regSize, regStart);
  1518   1530       sqlite3VdbeAddOp3(v, OP_Subtract, regStart, regEnd, regEnd);
  1519   1531     }
  1520   1532   
  1521   1533     if( pMWin->pEnd && pMWin->pStart && pMWin->eEnd==TK_PRECEDING ){
  1522   1534       assert( pMWin->eStart==TK_PRECEDING );
  1523   1535       sqlite3VdbeAddOp3(v, OP_Le, regStart, sqlite3VdbeCurrentAddr(v)+3, regEnd);
         1536  +    VdbeCoverage(v);
  1524   1537       sqlite3VdbeAddOp2(v, OP_Copy, regSize, regStart);
  1525   1538       sqlite3VdbeAddOp2(v, OP_Copy, regSize, regEnd);
  1526   1539     }
  1527   1540   
  1528   1541     /* Initialize the accumulator register for each window function to NULL */
  1529   1542     regArg = windowInitAccum(pParse, pMWin);
  1530   1543   
  1531   1544     sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr, lblFlushDone);
         1545  +  VdbeCoverage(v);
  1532   1546     sqlite3VdbeAddOp2(v, OP_Rewind, csrStart, lblFlushDone);
         1547  +  VdbeCoverageNeverTaken(v);
  1533   1548     sqlite3VdbeChangeP5(v, 1);
  1534   1549     sqlite3VdbeAddOp2(v, OP_Rewind, csrEnd, lblFlushDone);
         1550  +  VdbeCoverageNeverTaken(v);
  1535   1551     sqlite3VdbeChangeP5(v, 1);
  1536   1552   
  1537   1553     /* Invoke AggStep function for each window function using the row that
  1538   1554     ** csrEnd currently points to. Or, if csrEnd is already at EOF,
  1539   1555     ** do nothing.  */
  1540   1556     addrTop = sqlite3VdbeCurrentAddr(v);
  1541   1557     if( pMWin->eEnd==TK_PRECEDING ){
  1542   1558       addrIfPos1 = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0 , 1);
         1559  +    VdbeCoverage(v);
  1543   1560     }
  1544   1561     sqlite3VdbeAddOp2(v, OP_Next, csrEnd, sqlite3VdbeCurrentAddr(v)+2);
         1562  +  VdbeCoverage(v);
  1545   1563     addr = sqlite3VdbeAddOp0(v, OP_Goto);
  1546   1564     windowAggStep(pParse, pMWin, csrEnd, 0, regArg, regSize);
  1547   1565     if( pMWin->eEnd==TK_UNBOUNDED ){
  1548   1566       sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop);
  1549   1567       sqlite3VdbeJumpHere(v, addr);
  1550   1568       addrTop = sqlite3VdbeCurrentAddr(v);
  1551   1569     }else{
................................................................................
  1553   1571       if( pMWin->eEnd==TK_PRECEDING ){
  1554   1572         sqlite3VdbeJumpHere(v, addrIfPos1);
  1555   1573       }
  1556   1574     }
  1557   1575   
  1558   1576     if( pMWin->eEnd==TK_FOLLOWING ){
  1559   1577       addrIfPos1 = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0 , 1);
         1578  +    VdbeCoverage(v);
  1560   1579     }
  1561   1580     if( pMWin->eStart==TK_FOLLOWING ){
  1562   1581       addrIfPos2 = sqlite3VdbeAddOp3(v, OP_IfPos, regStart, 0 , 1);
         1582  +    VdbeCoverage(v);
  1563   1583     }
  1564   1584     windowAggFinal(pParse, pMWin, 0);
  1565   1585     windowReturnOneRow(pParse, pMWin, regGosub, addrGosub);
  1566   1586     sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)+2);
         1587  +  VdbeCoverage(v);
  1567   1588     sqlite3VdbeAddOp2(v, OP_Goto, 0, lblFlushDone);
  1568   1589     if( pMWin->eStart==TK_FOLLOWING ){
  1569   1590       sqlite3VdbeJumpHere(v, addrIfPos2);
  1570   1591     }
  1571   1592   
  1572   1593     if( pMWin->eStart==TK_CURRENT 
  1573   1594      || pMWin->eStart==TK_PRECEDING 
  1574   1595      || pMWin->eStart==TK_FOLLOWING 
  1575   1596     ){
  1576   1597       int addrJumpHere = 0;
  1577   1598       if( pMWin->eStart==TK_PRECEDING ){
  1578   1599         addrJumpHere = sqlite3VdbeAddOp3(v, OP_IfPos, regStart, 0 , 1);
         1600  +      VdbeCoverage(v);
  1579   1601       }
  1580   1602       sqlite3VdbeAddOp2(v, OP_Next, csrStart, sqlite3VdbeCurrentAddr(v)+1);
         1603  +    VdbeCoverage(v);
  1581   1604       windowAggStep(pParse, pMWin, csrStart, 1, regArg, regSize);
  1582   1605       if( addrJumpHere ){
  1583   1606         sqlite3VdbeJumpHere(v, addrJumpHere);
  1584   1607       }
  1585   1608     }
  1586   1609     if( pMWin->eEnd==TK_FOLLOWING ){
  1587   1610       sqlite3VdbeJumpHere(v, addrIfPos1);
................................................................................
  1744   1767   
  1745   1768     windowPartitionCache(pParse, p, pWInfo, regFlushPart, lblFlushPart, &regSize);
  1746   1769     addrGoto = sqlite3VdbeAddOp0(v, OP_Goto);
  1747   1770   
  1748   1771     /* Start of "flush_partition" */
  1749   1772     sqlite3VdbeResolveLabel(v, lblFlushPart);
  1750   1773     sqlite3VdbeAddOp2(v, OP_Once, 0, sqlite3VdbeCurrentAddr(v)+2);
         1774  +  VdbeCoverage(v);
  1751   1775     sqlite3VdbeAddOp2(v, OP_OpenDup, csrLead, pMWin->iEphCsr);
  1752   1776   
  1753   1777     /* Initialize the accumulator register for each window function to NULL */
  1754   1778     regArg = windowInitAccum(pParse, pMWin);
  1755   1779   
  1756   1780     sqlite3VdbeAddOp2(v, OP_Integer, 0, regCtr);
  1757   1781     sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty);
         1782  +  VdbeCoverage(v);
  1758   1783     sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr, lblEmpty);
         1784  +  VdbeCoverageNeverTaken(v);
  1759   1785   
  1760   1786     if( bReverse ){
  1761   1787       int addr = sqlite3VdbeCurrentAddr(v);
  1762   1788       windowAggStep(pParse, pMWin, csrLead, 0, regArg, regSize);
  1763   1789       sqlite3VdbeAddOp2(v, OP_Next, csrLead, addr);
         1790  +    VdbeCoverage(v);
  1764   1791       sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty);
         1792  +    VdbeCoverageNeverTaken(v);
  1765   1793     }
  1766   1794     addrNext = sqlite3VdbeCurrentAddr(v);
  1767   1795   
  1768   1796     if( pOrderBy && (pMWin->eEnd==TK_CURRENT || pMWin->eStart==TK_CURRENT) ){
  1769   1797       int bCurrent = (pMWin->eStart==TK_CURRENT);
  1770   1798       int addrJump = 0;             /* Address of OP_Jump below */
  1771   1799       if( pMWin->eType==TK_RANGE ){
................................................................................
  1774   1802         KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOrderBy, 0, 0);
  1775   1803         for(k=0; k<nPeer; k++){
  1776   1804           sqlite3VdbeAddOp3(v, OP_Column, csrLead, iOff+k, regNewPeer+k);
  1777   1805         }
  1778   1806         addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPeer, regPeer, nPeer);
  1779   1807         sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
  1780   1808         addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2);
         1809  +      VdbeCoverage(v);
  1781   1810         sqlite3VdbeAddOp3(v, OP_Copy, regNewPeer, regPeer, nPeer-1);
  1782   1811       }
  1783   1812   
  1784   1813       windowReturnRows(pParse, pMWin, regCtr, regGosub, addrGosub, 
  1785   1814           (bCurrent ? regArg : 0), (bCurrent ? regSize : 0)
  1786   1815       );
  1787   1816       if( addrJump ) sqlite3VdbeJumpHere(v, addrJump);
................................................................................
  1788   1817     }
  1789   1818   
  1790   1819     if( bReverse==0 ){
  1791   1820       windowAggStep(pParse, pMWin, csrLead, 0, regArg, regSize);
  1792   1821     }
  1793   1822     sqlite3VdbeAddOp2(v, OP_AddImm, regCtr, 1);
  1794   1823     sqlite3VdbeAddOp2(v, OP_Next, csrLead, addrNext);
         1824  +  VdbeCoverage(v);
  1795   1825   
  1796   1826     windowReturnRows(pParse, pMWin, regCtr, regGosub, addrGosub, 0, 0);
  1797   1827   
  1798   1828     sqlite3VdbeResolveLabel(v, lblEmpty);
  1799   1829     sqlite3VdbeAddOp1(v, OP_ResetSorter, pMWin->iEphCsr);
  1800   1830     sqlite3VdbeAddOp1(v, OP_Return, regFlushPart);
  1801   1831   
................................................................................
  1888   1918   
  1889   1919       if( pPart ){
  1890   1920         int regNewPart = reg + pMWin->nBufferCol;
  1891   1921         KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pPart, 0, 0);
  1892   1922         addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart,nPart);
  1893   1923         sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
  1894   1924         addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2);
         1925  +      VdbeCoverage(v);
  1895   1926         windowAggFinal(pParse, pMWin, 1);
  1896   1927         if( pOrderBy ){
  1897   1928           addrGoto = sqlite3VdbeAddOp0(v, OP_Goto);
  1898   1929         }
  1899   1930       }
  1900   1931   
  1901   1932       if( pOrderBy ){
................................................................................
  1904   1935   
  1905   1936         if( addrJump ) sqlite3VdbeJumpHere(v, addrJump);
  1906   1937         if( pMWin->eType==TK_RANGE ){
  1907   1938           KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOrderBy, 0, 0);
  1908   1939           addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPeer, regPeer, nPeer);
  1909   1940           sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
  1910   1941           addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2);
         1942  +        VdbeCoverage(v);
  1911   1943         }else{
  1912   1944           addrJump = 0;
  1913   1945         }
  1914   1946         windowAggFinal(pParse, pMWin, pMWin->eStart==TK_CURRENT);
  1915   1947         if( addrGoto ) sqlite3VdbeJumpHere(v, addrGoto);
  1916   1948       }
  1917   1949   
  1918   1950       sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr,sqlite3VdbeCurrentAddr(v)+3);
         1951  +    VdbeCoverage(v);
  1919   1952       sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub);
  1920   1953       sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)-1);
         1954  +    VdbeCoverage(v);
  1921   1955   
  1922   1956       sqlite3VdbeAddOp1(v, OP_ResetSorter, pMWin->iEphCsr);
  1923   1957       sqlite3VdbeAddOp3(
  1924   1958           v, OP_Copy, reg+pMWin->nBufferCol, pMWin->regPart, nPart+nPeer-1
  1925   1959       );
  1926   1960   
  1927   1961       if( addrJump ) sqlite3VdbeJumpHere(v, addrJump);
................................................................................
  1941   1975     sqlite3VdbeAddOp3(v, OP_Insert, pMWin->iEphCsr, regRecord, regRowid);
  1942   1976   
  1943   1977     /* End the database scan loop. */
  1944   1978     sqlite3WhereEnd(pWInfo);
  1945   1979   
  1946   1980     windowAggFinal(pParse, pMWin, 1);
  1947   1981     sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr,sqlite3VdbeCurrentAddr(v)+3);
         1982  +  VdbeCoverage(v);
  1948   1983     sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub);
  1949   1984     sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)-1);
         1985  +  VdbeCoverage(v);
  1950   1986   }
  1951   1987   
  1952   1988   /*
  1953   1989   ** Allocate and return a duplicate of the Window object indicated by the
  1954   1990   ** third argument. Set the Window.pOwner field of the new object to
  1955   1991   ** pOwner.
  1956   1992   */