private static void checkExprVarUse(Query query)
{
if ( query.hasGroupBy() )
{
VarExprList groupKey = query.getGroupBy() ;
// Copy - we need to add variables
// SELECT (count(*) AS ?C) (?C+1 as ?D)
List<Var> inScopeVars = new ArrayList<>(groupKey.getVars()) ;
VarExprList exprList = query.getProject() ;
for ( Var v : exprList.getVars() )
{
// In scope?
Expr e = exprList.getExpr( v );
if ( e == null )
{
if ( !inScopeVars.contains( v ) )
{
throw new QueryParseException( "Non-group key variable in SELECT: " + v, -1, -1 );