I am trying to add a new column to spark data frame as below:
val abc :Array[String] = ("a","b","c","d")
I am trying to add this Array[String] as new column to dataframe and trying to do sha2 on that new column
var words=abc.mkString("||") source = source.withColumn("newcolumn", sha2(col(words), 256).cast(StringType))
It complied and the runtime error i am getting as
Exception in thread "main" org.apache.spark.sql.AnalysisException: cannot resolve 'a||b||c||d||e
' given input columns:
The expected output should be a dataframe with newcolum as column name and the value as varchar64 with sha2 of concatenate of Array of string with ||.
Anyhelp is appreciated.