private SqlNode getAgg ( SqlSelect select ) { final SelectScope selectScope = getRawSelectScope ( select ) ; if ( selectScope != null ) { final List < SqlNode > selectList = selectScope . getExpandedSelectList ( ) ; if ( selectList != null ) { return aggFinder . findAgg ( selectList ) ; } } return aggFinder . findAgg ( select . getSelectList ( ) ) ; }
If there is at least one call to an aggregate function returns the first .