Add a column to spark dataframe which contains list of all column names of the current row whose value is not null
问题 Hi I want to add a new column to a dafaframe which contains the list of all column names(for that row) which are not null. How do I achieve this in Scala. Please help. val baseDF = Seq( (3, "California", "name1", 9846, null, "SFO"), (1, "Oregon", "name2", 9847, null, null), (2, null, null, null, null, null) ).toDF("emp_id", "emp_city", "emp_name", "emp_phone", "emp_sal", "emp_site") Expected output is new column named "NonNullColumns" with expected non null column names for each row: