uros-b commented on code in PR #56850:
URL: https://github.com/apache/spark/pull/56850#discussion_r3492543745


##########
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala:
##########
@@ -407,6 +408,19 @@ class HiveUDFSuite extends QueryTest with 
TestHiveSingleton {
     }
   }
 
+  test("SPARK-57556: TIME type is unsupported as a Hive UDF argument") {
+    withUserDefinedFunction("testGenericUDFHash" -> true) {
+      sql(s"CREATE TEMPORARY FUNCTION testGenericUDFHash AS 
'${classOf[GenericUDFHash].getName}'")
+      // The Hive UDF resolver wraps the underlying failure, but the message 
must still clearly
+      // identify the unsupported TIME type rather than surfacing a 
MatchError/internal error.
+      val e = intercept[AnalysisException] {
+        sql("SELECT testGenericUDFHash(TIME'12:01:02')").collect()
+      }
+      assert(e.getMessage.contains("UNSUPPORTED_DATATYPE"))
+      assert(e.getMessage.contains(TimeType().sql))

Review Comment:
   Nit: please use checkError instead of assert/contains.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to