uros-b commented on code in PR #56880:
URL: https://github.com/apache/spark/pull/56880#discussion_r3496952938
##########
sql/core/src/test/scala/org/apache/spark/sql/FunctionQualificationSuite.scala:
##########
@@ -418,6 +418,32 @@ class FunctionQualificationSuite extends
SharedSparkSession {
)
}
+ test("SPARK-44800: Error Cases - DROP FUNCTION expects a persistent
function") {
+ sql("CREATE TEMPORARY FUNCTION drop_persistent_test() RETURNS INT RETURN
1")
+ val sqlText = "DROP FUNCTION drop_persistent_test"
+ try {
+ checkError(
+ exception = intercept[AnalysisException] {
+ sql(sqlText)
+ },
+ condition = "EXPECT_PERSISTENT_FUNCTION_NOT_TEMP",
+ sqlState = "42809",
+ parameters = Map(
+ "functionName" -> "`drop_persistent_test`",
+ "operation" -> "DROP FUNCTION",
+ "alternative" -> " Please use DROP TEMPORARY FUNCTION to drop a
temporary function."
+ ),
+ context = ExpectedContext(
+ fragment = sqlText,
+ start = 0,
+ stop = sqlText.length - 1
+ )
+ )
+ } finally {
+ sql("DROP TEMPORARY FUNCTION IF EXISTS drop_persistent_test")
+ }
+ }
Review Comment:
Nit: this tests only covers the Some(hint) (non-empty alternative) branch;
the None/empty-alternative formatting path is untested.
--
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]