import org.apache.spark.sql.functions

val actualDF = sourceDF.withColumn(
"word1_word2_levenshtein",
functions.levenshtein(sourceDF.col("word1"), sourceDF.col("word2"))
)

actualDF.show()
+------+-------+-----------------------+
| word1| word2|word1_word2_levenshtein|
+------+-------+-----------------------+
| blah| blah| 0|
| cat| bat| 1|
| phat| fat| 2|
|kitten|sitting| 3|
+------+-------+-----------------------+