HyukjinKwon commented on a change in pull request #24961: [SPARK-28158][SQL] Hive UDFs supports UDT type URL: https://github.com/apache/spark/pull/24961#discussion_r304780492
########## File path: mllib/src/test/scala/org/apache/spark/ml/linalg/VectorUDTSuite.scala ########## @@ -44,4 +45,39 @@ class VectorUDTSuite extends SparkFunSuite { assert(dataType.asInstanceOf[StructType].fields.map(_.dataType) === Seq(new VectorUDT, DoubleType)) } + + test("SPARK-28158 Hive UDFs supports UDT type") { + val functionName = "Logistic_Regression" + val sql = spark.sql _ + try { + val df = spark.read.format("libsvm").options(Map("vectorType" -> "dense")) + .load(TestHive.getHiveFile("test-data/libsvm/sample_libsvm_data.txt").getPath) + df.createOrReplaceTempView("src") + + // `Logistic_Regression` accepts features (with Vector type), and returns the + // prediction value. To simplify the UDF implementation, the `Logistic_Regression` + // will return 0.95d directly. + sql( + s""" + |CREATE FUNCTION Logistic_Regression + |AS 'org.apache.spark.sql.hive.LogisticRegressionUDF' + |USING JAR '${TestHive.getHiveFile("TestLogRegUDF.jar").toURI}' Review comment: What's the code in `TestLogRegUDF.jar`? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org