Hi I am using withColumn with when otherwise to update a column value
val df2 = df.withColumn("col_1", when(col("col_1") > col("col_2"),col("col_2")).otherwise(col("col_1")))
but my requirement is to make this statement generic so some one can pass a string like
"col(\"col_1\") > col(\"col_2\")" and it can be passed to when function
this string can have logical operators like &&, ||
Is their a way to pass string expression into Column? Or is their another way to pass these values dynamically?
Thanks