LuciferYang commented on code in PR #45896:
URL: https://github.com/apache/spark/pull/45896#discussion_r1713286659


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/ExecuteImmediateEndToEndSuite.scala:
##########
@@ -36,4 +37,30 @@ class ExecuteImmediateEndToEndSuite extends QueryTest with 
SharedSparkSession {
       spark.sql("DROP TEMPORARY VARIABLE IF EXISTS parm;")
     }
   }
+
+  test("EXEC IMMEDIATE STACK OVERFLOW") {
+    try {
+      spark.sql("DECLARE parm = 1;")
+      val query = (1 to 20000).map(x => "SELECT 1 as a").mkString(" UNION ALL 
")
+      Seq(
+        s"EXECUTE IMMEDIATE '$query'",
+        s"EXECUTE IMMEDIATE '$query' INTO parm").foreach { q =>
+        val e = intercept[ParseException] {
+          spark.sql(q)
+        }
+
+        checkError(
+          exception = intercept[ParseException](sql(query).collect()),

Review Comment:
   @milastdbx For this case, there's something I don't quite understand. 
Earlier, we obtained `e` through
   
   ```scala
   val e = intercept[ParseException] {
     spark.sql(q)
   }
   ```
   
   but here `checkError` and `e` are not related. Is there a mistake in this 
case? Or is it that I haven't understood the intention of this test?
   
   also cc @cloud-fan @srielau 



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