I am new to scala, I have a below sql that needs to be converted to scala, I have pasted what I tried but I am getting an error.
SQL code:
select (jess,
mark,
timestamp1,
timestamp2,
(CASE WHEN timestamp1>timstamp2 then null else salary) as salary,
(CASE WHEN timestamp1>timstamp2 then null else manager) as manager
)
Scala code I tried:
df.select (jess,
mark,
timestamp1,
timestamp2,
salary
)
.withColumn("salary", when($"timestamp1">$"timstamp2", salary ).otherwise("null"))
Is there a different way to write this.