No telling if I’ll ever need this again, but this weekend I was helping someone with some Scala Spark work, and the short version of the story is that they were ending up with null values in their data after creating a Spark join. The null values were ending up in two fields, one named balance and another named accountId, so I created these two Spark udf functions to fix the data, converting null values into Long in the first example, and null values into empty strings in the second example: