hello all,
i have a single udf that creates 2 outputs (so a tuple 2). i would like to
add these 2 columns to my dataframe.
my current solution is along these lines:
df
.withColumn("_temp_", udf(inputColumns))
.withColumn("x", col("_temp_)("_1"))
.withColumn("y", col("_temp_")("_2"))
.drop("_temp_")
this works, but its not pretty with the temporary field stuff.
i also tried this:
val tmp = udf(inputColumns)
df
.withColumn("x", tmp("_1"))
.withColumn("y", tmp("_2"))
this also works, but unfortunately the udf is evaluated twice
is there a better way to do this?
thanks! koert