Not sure how you are using this, but why do you need a Aggr() function here?? You don't even have an outer aggregation. May be you need to add a outer aggregation or may be you just don't need Aggr(). Difficult to say whats right and whats not without knowing the intent