This is an automated email from the ASF dual-hosted git repository.

chengchengjin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 0f88d2a87f [VL] tools/workload/tpch: Close sql files to avoid 
resources leak (#10785)
0f88d2a87f is described below

commit 0f88d2a87fb8e672fc6fff668ccb918cd48df2e8
Author: xinghuayu007 <[email protected]>
AuthorDate: Mon Oct 13 04:41:21 2025 +0800

    [VL] tools/workload/tpch: Close sql files to avoid resources leak (#10785)
    
    * [GLUTEN] Close sql files to avoid resouce leak
    
    * refactor code
    
    ---------
    
    Co-authored-by: 汪细勖(WangXixu)-顺丰科技技术集团 <[email protected]>
---
 tools/workload/tpch/run_tpch/tpch_parquet.scala | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/workload/tpch/run_tpch/tpch_parquet.scala 
b/tools/workload/tpch/run_tpch/tpch_parquet.scala
index 53987633c2..2bb5004e45 100644
--- a/tools/workload/tpch/run_tpch/tpch_parquet.scala
+++ b/tools/workload/tpch/run_tpch/tpch_parquet.scala
@@ -78,10 +78,16 @@ val sorted = fileLists.sortBy {
 
 // Main program to run TPC-H testing
 for (t <- sorted) {
+  val fileContents = {
+    val src = Source.fromFile(t)
+    try {
+      src.getLines().filter(!_.startsWith("--")).mkString(" ")
+    } finally {
+      src.close()
+    }
+  }
   println(t)
-  val fileContents = 
Source.fromFile(t).getLines.filter(!_.startsWith("--")).mkString(" ")
   println(fileContents)
   time{spark.sql(fileContents).collectAsList()}
-  //spark.sql(fileContents).explain
   Thread.sleep(2000)
 }


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

Reply via email to