The Average Function supports Nulll values. By default null points are included in the average calculation.
Example:
avgFunction.setIncludeNulls(false);