import org.apache.spark.sql.functions.{udf, explode}
val zip = udf((xs: Seq Long » , ys: Seq Long » ) => xs.zip(ys))
df.withColumn("vars", explode(zip_udf($"varA", $"varB"))).select(
$"userId", $"someString",
$"vars._1".alias("varA"), $"vars._2".alias("varB")).show