How do I take the average of columns in an array `cols` with non-null values in a dataframe `df`? I can do this for *all* columns but it gives null when any of the values are null.

```
val cols = Array($"col1", $"col2", $"col3")
df.withColumn("avgCols", cols.foldLeft(lit(0)){(x, y) => x + y} / cols.length)

```

I don't want to `na.fill` because I want to preserve the true average.