mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Experimental implementation of FILTER clause for aggregate functions.
FossilOrigin-Name: 1f1ae2d6ac8dcbb62e5aa3dc17bc67d559cb565fc0d0a8c00a596075d35f8130
This commit is contained in:
12
src/window.c
12
src/window.c
@@ -1178,13 +1178,10 @@ void sqlite3WindowChain(Parse *pParse, Window *pWin, Window *pList){
|
||||
/*
|
||||
** Attach window object pWin to expression p.
|
||||
*/
|
||||
void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){
|
||||
void sqlite3WindowAttach(Parse *pParse, Expr *p, Expr *pFilter, Window *pWin){
|
||||
if( p ){
|
||||
assert( p->op==TK_FUNCTION );
|
||||
/* This routine is only called for the parser. If pWin was not
|
||||
** allocated due to an OOM, then the parser would fail before ever
|
||||
** invoking this routine */
|
||||
if( ALWAYS(pWin) ){
|
||||
if( pWin ){
|
||||
p->y.pWin = pWin;
|
||||
ExprSetProperty(p, EP_WinFunc);
|
||||
pWin->pOwner = p;
|
||||
@@ -1192,9 +1189,14 @@ void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){
|
||||
sqlite3ErrorMsg(pParse,
|
||||
"DISTINCT is not supported for window functions");
|
||||
}
|
||||
pWin->pFilter = pFilter;
|
||||
}else if( pFilter ){
|
||||
p->y.pFilter = pFilter;
|
||||
ExprSetProperty(p, EP_Filter);
|
||||
}
|
||||
}else{
|
||||
sqlite3WindowDelete(pParse->db, pWin);
|
||||
sqlite3ExprDelete(pParse->db, pFilter);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user