Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18355#discussion_r122846910
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/StateStoreCoordinatorSuite.scala
 ---
    @@ -107,6 +115,43 @@ class StateStoreCoordinatorSuite extends SparkFunSuite 
with SharedSparkContext {
           }
         }
       }
    +
    +  test("query stop deactivates related store providers") {
    +    var coordRef: StateStoreCoordinatorRef = null
    +    try {
    +      val spark = SparkSession.builder().sparkContext(sc).getOrCreate()
    +      import spark.implicits._
    +      coordRef = spark.streams.stateStoreCoordinator
    +      implicit val sqlContext = spark.sqlContext
    +      spark.conf.set("spark.sql.shuffle.partitions", "1")
    +
    +      // Start a query and run a batch to load state stores
    +      val inputData = MemoryStream[Int]
    +      val aggregated = inputData.toDF().groupBy("value").agg(count("*")) 
// stateful query
    +      val checkpointLocation = Utils.createTempDir().getAbsoluteFile
    +      val query = aggregated.writeStream
    +        .format("memory")
    +        .outputMode("update")
    +        .queryName("query")
    +        .option("checkpointLocation", checkpointLocation.toString)
    +        .start()
    +      inputData.addData(1, 2, 3)
    +      query.processAllAvailable()
    +
    +      // Verify state store has been loaded
    +      val stateCheckpointDir =
    +        
query.asInstanceOf[StreamingQueryWrapper].streamingQuery.lastExecution.checkpointLocation
    +      val providerId = 
StateStoreProviderId(StateStoreId(stateCheckpointDir, 0, 0), query.runId)
    +      assert(coordRef.getLocation(providerId).nonEmpty)
    +
    +      // Stop and verify whether the stores are deactivated in the 
coordinator
    +      query.stop()
    +      assert(coordRef.getLocation(providerId).isEmpty)
    +
    --- End diff --
    
    remove this line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to