I know how to write the custom function which can be applied on all columns at a time in pyspark. Below are the steps: 1)In pyspark i change the data structure using explode fun