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


##########
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:
   Oh you mean another test case. The reason I added it is because the first 
one is `SimpleHigherOrderFunction` which has 1 arg and 1 function and this one 
is a bit more complex. We can remove it if you don't think it provides any value



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