I am calling a udf on a specific column of my dataframe, in which I check if all values are valid as per a specified date format.
sourcefile = sourcefile.withColumn(column, DateConversion(col(column)))
Here DateConversion is my udf. My question here is that, is there a way by which I can pass the valid date format "yyyy/MM/dd" as a string to this udf which can be used internally in the udf for validation purposes.
I was trying
sourcefile = sourcefile.withColumn(column, DateConversion(col(column),"yyyy/MM/dd"))
But this gives and error.