I have a spark dataframe and I want to add few columns if doesn't already exists.
df1:
id Name age
1 Abc 20
2 def 30
I want to check if columns are not already exists in df and if doesn't exist add columns: 'gender','city','contact' to df1 and populate null values in them and finally obtain:
df1:
id Name age gender city contact
1 Abc 20
2 def 30