From 5bc9a2787c2063b94db719e10cebcd265c5c381e Mon Sep 17 00:00:00 2001 From: comphead Date: Thu, 9 May 2024 08:18:41 -0700 Subject: [PATCH] Update spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala Co-authored-by: advancedxy --- .../org/apache/comet/CometExpressionCoverageSuite.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala b/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala index a3b38e6f94..45921883f4 100644 --- a/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala @@ -213,8 +213,9 @@ class CometExpressionCoverageSuite extends CometTestBase with AdaptiveSparkPlanH sys.error("DATAFUSIONCLI_PATH env variable not set")) val tempFilePath = Files.createTempFile("temp-", ".sql") + try { Files.write(tempFilePath, sql.getBytes) - + val command = s"""$datafusionCliPath/datafusion-cli -f $tempFilePath""" val stdout = new StringBuilder @@ -225,8 +226,9 @@ class CometExpressionCoverageSuite extends CometTestBase with AdaptiveSparkPlanH out => stdout.append(out).append("\n"), // stdout err => stderr.append(err).append("\n") // stderr )) - - Files.delete(tempFilePath) + } finally { + Files.delete(tempFilePath) + } val err = stderr.toString() val out = stdout.toString()