Two ways I tried :
Working - Create as temptable using createorreplacetempview() , and apply transformation using spark sql , it's working .
Not working - Creating as data frame and apply dataframe api for transformation . the below issue snippet has the exception details .
Thanks in advance .
