if(att == null && !(visitor instanceof CountVisitor)){
return null; // aggregate function optimization only supported for PropertyName expression
}
// if the visitor is limiting the result to a given start - max, we will
// try to apply limits to the aggregate query
LimitingVisitor limitingVisitor = null;
if(visitor instanceof LimitingVisitor) {
limitingVisitor = (LimitingVisitor) visitor;
}
//result of the function
try {