yaooqinn commented on a change in pull request #26599: [SPARK-29961][SQL] 
Implement builtin function - typeof
URL: https://github.com/apache/spark/pull/26599#discussion_r348447043
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/UserDefinedTypeSuite.scala
 ##########
 @@ -277,4 +279,12 @@ class UserDefinedTypeSuite extends QueryTest with 
SharedSparkSession with Parque
     val udt = new TestUDT.MyDenseVectorUDT()
     assert(!Cast.canUpCast(udt, StringType))
   }
+
+  test("SPARK-29961 typeof user defined type") {
+    val schema = new StructType().add("a", new TestUDT.MyDenseVectorUDT())
+    val data = Arrays.asList(
+      RowFactory.create(new TestUDT.MyDenseVector(Array(1.0, 3.0, 5.0, 7.0, 
9.0))))
+    checkAnswer(spark.createDataFrame(data, schema).selectExpr("typeof(a)"),
+      Seq(Row("array<double>")))
 
 Review comment:
   Spark contributors also can benefit from this function. I suggest we make it 
support for `udt`s . WDYT? @clould-fan

----------------------------------------------------------------
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]

Reply via email to