Created
June 15, 2020 15:48
-
-
Save sllynn/bd013753716a223bb666eea88588257a to your computer and use it in GitHub Desktop.
Convert VectorUDT to ArrayType (Scala UDF)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.spark.ml.linalg.Vector | |
val toArray = udf { v: Vector => v.toArray } | |
spark.sqlContext.udf.register("toArray", toArray) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment