private static void checkExprVarUse(Query query)
{
if ( query.hasGroupBy() )
{
VarExprList groupKey = query.getGroupBy() ;
List<Var> groupVars = groupKey.getVars() ;
VarExprList exprList = query.getProject() ;
for ( Iterator<Var> iter = exprList.getVars().iterator() ; iter.hasNext() ; )
{
// In scope?
Var v = iter.next();
Expr e = exprList.getExpr(v) ;
if ( e == null )
{
if ( ! groupVars.contains(v) )
throw new QueryParseException("Non-group key variable in SELECT: "+v, -1 , -1) ;
}