I have a DataFrame in Apache Spark SQL, where I want to drop all columns where all values are NULL.
An example:
+-------+----+------+------+
| name| age|height|weight|
+-------+----+------+------+
| JUAN| 23| null| null|
| JAVIER|null| null| null|
| PABLO| 22| null| null|
| SERGIO|null| null| null|
|RODRIGO|null| null| null|
+-------+----+------+------+
And I want to have a new DataFrame without the columns with all values on NULL, so the output would be:
+-------+----+
| name| age|
+-------+----+
| JUAN| 23|
| JAVIER|null|
| PABLO| 22|
| SERGIO|null|
|RODRIGO|null|
+-------+----+
How can I do it on Apache Spark SQL? Im working on Java.