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



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/QueryExecutionSuite.scala
##########
@@ -99,17 +102,19 @@ class QueryExecutionSuite extends SharedSparkSession {
       val path = dir.getCanonicalPath + "/plans.txt"
       val df = spark.range(0, 10)
       df.queryExecution.debug.toFile(path, explainMode = Option("formatted"))
-      assert(Source.fromFile(path).getLines.toList
-        .takeWhile(_ != "== Whole Stage Codegen ==").map(_.replaceAll("#\\d+", 
"#x")) == List(
-        "== Physical Plan ==",
-        s"* Range (1)",
-        "",
-        "",
-        s"(1) Range [codegen id : 1]",
-        "Output [1]: [id#xL]",
-        s"Arguments: Range (0, 10, step=1, splits=Some(2))",
-        "",
-        ""))
+      Utils.tryWithResource(Source.fromFile(path)) { source =>

Review comment:
       Can you fix it as:
   
   ```scala
   val lines = Utils.tryWithResource(Source.fromFile(path))(_.getLines().toList)
   assert(lines
     .takeWhile(_ != "== Whole Stage Codegen ==").map(_.replaceAll("#\\d+", 
"#x")) == List(
   ...
   ```




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