dongjoon-hyun commented on a change in pull request #24739:
[SPARK-27875][CORE][SQL][ML][K8S] Wrap all PrintWriter with
Utils.tryWithResource
URL: https://github.com/apache/spark/pull/24739#discussion_r288845889
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala
##########
@@ -77,14 +78,14 @@ class StatisticsSuite extends StatisticsCollectionTestBase
with TestHiveSingleto
withTempDir { tempDir =>
// EXTERNAL OpenCSVSerde table pointing to LOCATION
val file1 = new File(tempDir + "/data1")
- val writer1 = new PrintWriter(file1)
- writer1.write("1,2")
- writer1.close()
+ Utils.tryWithResource(new PrintWriter(file1)) { writer1 =>
+ writer1.write("1,2")
+ }
val file2 = new File(tempDir + "/data2")
- val writer2 = new PrintWriter(file2)
- writer2.write("1,2")
- writer2.close()
+ Utils.tryWithResource(new PrintWriter(file2)) { writer2 =>
Review comment:
`writer2` -> `writer`.
----------------------------------------------------------------
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]