juliuszsompolski commented on code in PR #42216:
URL: https://github.com/apache/spark/pull/42216#discussion_r1278296020


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala:
##########
@@ -203,6 +203,35 @@ class SQLExecutionSuite extends SparkFunSuite {
       spark.stop()
     }
   }
+
+  test("jobTags property.") {
+    val spark = 
SparkSession.builder.master("local[*]").appName("test").getOrCreate()
+
+    // Disable Photon as the test uses a local spark session and hence JNI is 
not initialized.
+    val jobTag = "jobTag"
+    spark.sparkContext.addJobTag(jobTag)
+
+    var jobTags: Option[String] = None
+    var sqlJobTags: Set[String] = Set.empty
+    spark.sparkContext.addSparkListener(new SparkListener {
+      override def onJobStart(jobStart: SparkListenerJobStart): Unit = {
+        jobTags = 
Some(jobStart.properties.getProperty(SparkContext.SPARK_JOB_TAGS))
+      }
+      override def onOtherEvent(event: SparkListenerEvent): Unit = {
+        event match {
+          case e: SparkListenerSQLExecutionStart =>
+            sqlJobTags = e.jobTags
+        }
+      }
+    })
+
+    spark.range(1).collect()
+
+    assert(jobTags.contains(jobTag))
+    assert(sqlJobTags.contains(jobTag))
+
+    spark.stop()

Review Comment:
   other tests around here seem to wrap in try and do spark.stop() in finally.
   Could you also do spark.sparkContext.removeJobTag(jobTag) in the finally, as 
otherwise I think the SparkContext gets shared between tests and the tag can 
get leaked into other tests?



##########
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala:
##########
@@ -203,6 +203,35 @@ class SQLExecutionSuite extends SparkFunSuite {
       spark.stop()
     }
   }
+
+  test("jobTags property.") {
+    val spark = 
SparkSession.builder.master("local[*]").appName("test").getOrCreate()
+
+    // Disable Photon as the test uses a local spark session and hence JNI is 
not initialized.

Review Comment:
   nit: this comment seems unrelated and accidentally copied over from 
somewhere.



##########
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala:
##########
@@ -203,6 +203,35 @@ class SQLExecutionSuite extends SparkFunSuite {
       spark.stop()
     }
   }
+
+  test("jobTags property.") {

Review Comment:
   nit: remove "." from test name



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