Is there any better way to implement the below code in spark scala , instead of how I am doing currently ? . Please note . its nested if condiditions if --> else if { if else