@ Override public Expression getValueExpression ( ) { return ifThenElse ( equalTo ( count , literal ( 0L ) ) , nullOf ( getResultType ( ) ) , div ( sum , count ) ) ; }
If all input are nulls count will be 0 and we will get null after the division .