If SSE is enabled, set the P1 field of OP_AggInit instructions to the

number of arguments that will be passed to the aggregate function. (CVS 2484)

FossilOrigin-Name: 7f67b9f0f398583651d226fabf2fafd2635d772a
This commit is contained in:
danielk1977
2005-05-26 14:41:47 +00:00
parent 1f723bd904
commit 5c2d9155de
4 changed files with 24 additions and 12 deletions
+9 -2
View File
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.247 2005/05/19 08:43:00 danielk1977 Exp $
** $Id: select.c,v 1.248 2005/05/26 14:41:47 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -2735,7 +2735,14 @@ int sqlite3Select(
for(i=0; i<pParse->nAgg; i++){
FuncDef *pFunc;
if( (pFunc = pParse->aAgg[i].pFunc)!=0 && pFunc->xFinalize!=0 ){
sqlite3VdbeOp3(v, OP_AggInit, 0, i, (char*)pFunc, P3_FUNCDEF);
int nExpr = 0;
#ifdef SQLITE_SSE
Expr *pAggExpr = pParse->aAgg[i].pExpr;
if( pAggExpr && pAggExpr->pList ){
nExpr = pAggExpr->pList->nExpr;
}
#endif
sqlite3VdbeOp3(v, OP_AggInit, nExpr, i, (char*)pFunc, P3_FUNCDEF);
}
}
if( pGroupBy ){
+7 -2
View File
@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.465 2005/04/01 10:47:40 drh Exp $
** $Id: vdbe.c,v 1.466 2005/05/26 14:41:47 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -4337,11 +4337,16 @@ case OP_AggReset: { /* no-push */
break;
}
/* Opcode: AggInit * P2 P3
/* Opcode: AggInit P1 P2 P3
**
** Initialize the function parameters for an aggregate function.
** The aggregate will operate out of aggregate column P2.
** P3 is a pointer to the FuncDef structure for the function.
**
** The P1 argument is not used by this opcode. However if the SSE
** extension is compiled in, P1 is set to the number of arguments that
** will be passed to the aggregate function, if any. This is used
** by SSE to select the correct function when (de)serializing statements.
*/
case OP_AggInit: { /* no-push */
int i = pOp->p2;