WeichenXu123 commented on a change in pull request #27522: [WIP][SPARK-30762]
Add dtype=float32 support to vector_to_array UDF
URL: https://github.com/apache/spark/pull/27522#discussion_r377010294
##########
File path: mllib/src/test/scala/org/apache/spark/ml/FunctionsSuite.scala
##########
@@ -61,5 +61,20 @@ class FunctionsSuite extends MLTest {
"`org.apache.spark.ml.linalg.Vector` or
`org.apache.spark.mllib.linalg.Vector`, " +
s"but got ${valType}"))
}
+
+ val df3 = Seq(
+ (Vectors.dense(1.0, 2.0, 3.0), OldVectors.dense(10.0, 20.0, 30.0)),
+ (Vectors.sparse(3, Seq((0, 2.0), (2, 3.0))), OldVectors.sparse(3,
Seq((0, 20.0), (2, 30.0))))
+ ).toDF("vec", "oldVec")
+
+ val result3 = df3.select(
+ vector_to_array('vec, dtype = "float32"), vector_to_array('oldVec, dtype
= "float32"))
Review comment:
Check array type. Should be "Array<Float>", its corresponding dataframe type
is `ArrayType(elementType=FloatType)`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]