HashMap<Expression, Object> group = select.getCurrentGroup();
if (group == null) {
throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());
}
try {
AggregateFunction agg = (AggregateFunction) group.get(this);
if (agg == null) {
agg = getInstance();
}
Object obj = agg.getResult();
if (obj == null) {
return ValueNull.INSTANCE;
}
return DataType.convertToValue(session, obj, dataType);
} catch (SQLException e) {