cloud-fan commented on code in PR #52286:
URL: https://github.com/apache/spark/pull/52286#discussion_r2443609533


##########
sql/core/src/test/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionSuite.scala:
##########
@@ -3104,4 +3108,23 @@ class SqlScriptingExecutionSuite extends QueryTest with 
SharedSparkSession {
       verifySqlScriptResult(sqlScript2, expected)
     }
   }
+
+  test("sqlScriptId is populated in SparkListenerSQLExecutionStart") {
+    val scriptIds = new ListBuffer[Option[String]]
+    spark.sparkContext.addSparkListener(new SparkListener {
+      override def onOtherEvent(event: SparkListenerEvent): Unit = event match 
{
+        case start: SparkListenerSQLExecutionStart =>
+          scriptIds.append(start.sqlScriptId)
+      }
+    })
+
+    spark.sql("begin select 1; select 2; end")
+
+    // Assert script id exist and is identical for all events.
+    assert(scriptIds.forall(_.isDefined))
+    assert(scriptIds.distinct.size == 1)

Review Comment:
   why call `distinct`? will we trigger two script executions?



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