mihailotim-db commented on code in PR #50345:
URL: https://github.com/apache/spark/pull/50345#discussion_r2007371277


##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala:
##########
@@ -1069,6 +1069,29 @@ class QueryCompilationErrorsSuite
       context = ExpectedContext(fragment = "in (select map(1,2))", start = 16, 
stop = 35)
     )
   }
+
+  test("SPARK-51580: Throw proper user facing error message when lambda 
function is out of " +
+    "place in HigherOrderFunction") {
+    checkError(
+      exception = intercept[AnalysisException] {
+        sql("select transform(x -> x + 1, array(1,2,3))")
+      },
+      condition = 
"INVALID_LAMBDA_FUNCTION_CALL.LAMBDA_AS_HIGHER_ORDER_FUNCTION_ARGUMENT",
+      parameters = Map(),
+      context =
+        ExpectedContext(fragment = "transform(x -> x + 1, array(1,2,3))", 
start = 7, stop = 41)
+    )
+
+    checkError(
+      exception = intercept[AnalysisException] {
+        sql("select aggregate(array(1,2,3), x -> x + 1, 0)")

Review Comment:
   We don't have a test for this atm, so I guess yes?



##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala:
##########
@@ -1069,6 +1069,29 @@ class QueryCompilationErrorsSuite
       context = ExpectedContext(fragment = "in (select map(1,2))", start = 16, 
stop = 35)
     )
   }
+
+  test("SPARK-51580: Throw proper user facing error message when lambda 
function is out of " +
+    "place in HigherOrderFunction") {
+    checkError(
+      exception = intercept[AnalysisException] {
+        sql("select transform(x -> x + 1, array(1,2,3))")
+      },
+      condition = 
"INVALID_LAMBDA_FUNCTION_CALL.LAMBDA_AS_HIGHER_ORDER_FUNCTION_ARGUMENT",
+      parameters = Map(),
+      context =
+        ExpectedContext(fragment = "transform(x -> x + 1, array(1,2,3))", 
start = 7, stop = 41)
+    )
+
+    checkError(
+      exception = intercept[AnalysisException] {
+        sql("select aggregate(array(1,2,3), x -> x + 1, 0)")

Review Comment:
   We don't have a test for this atm, so I guess yes?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to