dongjoon-hyun commented on code in PR #60632:
URL: https://github.com/apache/spark/pull/60632#discussion_r4605383820


##########
sql/core/src/test/scala/org/apache/spark/sql/connector/ProcedureSuite.scala:
##########
@@ -494,6 +494,17 @@ class ProcedureSuite extends SharedSparkSession with 
BeforeAndAfter {
     assert(explain.contains("Call cat.ns.sum(5, 5)"), explain)
   }
 
+  test("SPARK-61889: CALL with an aggregate or window function in an 
argument") {
+    // The optimizer folds these arguments away, so the procedure must not be 
invoked.
+    catalog.createProcedure(Identifier.of(Array("ns"), "sum"), 
UnboundNonExecutableSum)
+    val call = "CALL cat.ns.sum(IF(true OR max(1) > 0, 1, 2), 2)"
+    checkError(
+      exception = intercept[AnalysisException](sql(call)),
+      condition = "UNSUPPORTED_EXPR_FOR_OPERATOR",
+      parameters = Map("operator" -> "Call", "invalidExprSqls" -> 
"\"max(1)\""),
+      context = ExpectedContext(fragment = call, start = 0, stop = call.length 
- 1))
+  }

Review Comment:
   Thanks, applied as suggested in 28fbb66e808 (window and generator cases 
added, test renamed). `ProcedureSuite`, `StaticProcedureSuite` and 
`ParseSqlAnalyzeSuite` pass.



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