I don't have any ideas to get column names when it has null value
For example,
case class A(name: String, id: String, email: String, company: String)
val e1 = A("n1", null, "[email protected]", null)
val e2 = A("n2", null, "[email protected]", null)
val e3 = A("n3", null, "[email protected]", null)
val e4 = A("n4", null, "[email protected]", null)
val e5 = A("n5", null, "[email protected]", null)
val e6 = A("n6", null, "[email protected]", null)
val e7 = A("n7", null, "[email protected]", null)
val e8 = A("n8", null, "[email protected]", null)
val As = Seq(e1, e2, e3, e4, e5, e6, e7, e8)
val df = sc.parallelize(As).toDF
This code makes dataframe like this :
+----+----+---------+-------+
|name| id| email|company|
+----+----+---------+-------+
| n1|null|[email protected]| null|
| n2|null|[email protected]| null|
| n3|null|[email protected]| null|
| n4|null|[email protected]| null|
| n5|null|[email protected]| null|
| n6|null|[email protected]| null|
| n7|null|[email protected]| null|
| n8|null|[email protected]| null|
+----+----+---------+-------+
and I want to get column names all of their rows are null : id, company
I don't care the type of output. Array, String, RDD whatever
See Question&Answers more detail:
os