-2

I am trying to find the spark SQL for the following oracle function

IIF(ISNULL(TYPE_CODE),'UNASSIGNED',TYPE_CODE)
blackbishop
  • 30,945
  • 11
  • 55
  • 76
Raghu13
  • 21
  • 2

1 Answers1

0

In scala :

import  org.apache.spark.sql.{functions => f} 
val new_df = df_name.withColumn("col_name",f.when(f.col("other_col_name").isNull(),TYPE_CODE)
itIsNaz
  • 621
  • 5
  • 11