Ran into this a little while ago, and I think there should be a better/more efficient way of doing this:
I have a DF with about 70k columns and roughly 10k rows. I want to essentially get a count of each column based on the value of the row.
df.columns.map( c => df.where(column(c)===1).count )
This works for a small number of columns, but in this case, the large number of columns causes the process to take hours and appears to iterate through each column and query the data.
What optimizations can I do to get to the results faster?