attilapiros commented on a change in pull request #24079: 
[SPARK-27145][Minor]Close store  in the SQLAppStatusListenerSuite after test
URL: https://github.com/apache/spark/pull/24079#discussion_r265162114
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListenerSuite.scala
 ##########
 @@ -589,6 +602,7 @@ class SQLAppStatusListenerSuite extends SparkFunSuite with 
SharedSQLContext with
       time))
     assert(statusStore.executionsCount === 2)
     assert(statusStore.execution(2) === None)
+    store.close()
 
 Review comment:
   I would prefer closing the old `kvstore` right before the line:
   ```
       val store = new ElementTrackingStore(new InMemoryStore, conf)
   ```
   
   And modify the line to:
   ```
       kvstore = new ElementTrackingStore(new InMemoryStore, conf)
   ```
   
   And use `kvstore` instead of `store`.
   
   I know it is not a big leak but if the test fails meanwhile (because of 
assertion) there would no `close` called. 
   On the other hand a `try` . and `finally` is can be saved this way.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to