HyukjinKwon commented on a change in pull request #31323:
URL: https://github.com/apache/spark/pull/31323#discussion_r564217279



##########
File path: 
examples/src/main/scala/org/apache/spark/examples/DFSReadWriteTest.scala
##########
@@ -46,9 +47,7 @@ object DFSReadWriteTest {
   private val NPARAMS = 2
 
   private def readFile(filename: String): List[String] = {
-    val lineIter: Iterator[String] = fromFile(filename).getLines()
-    val lineList: List[String] = lineIter.toList
-    lineList
+    Utils.tryWithResource(fromFile(filename))(_.getLines()).toList

Review comment:
       I think you should call `getLines().toList` right? because `getLines()` 
is lazy and it won't consume before you call `toList`.




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



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

Reply via email to