This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new a895d553fe57 [SPARK-53133][SQL][TESTS] Use Java `System.getProperty` instead of `FileUtils.getTempDirectory` a895d553fe57 is described below commit a895d553fe57f46ef3edce825e786eb808510f3e Author: Dongjoon Hyun <dongj...@apache.org> AuthorDate: Tue Aug 5 17:10:48 2025 -0700 [SPARK-53133][SQL][TESTS] Use Java `System.getProperty` instead of `FileUtils.getTempDirectory` ### What changes were proposed in this pull request? This PR aims to use Java `System.getProperty` instead of `FileUtils.getTempDirectory`. In addition, a new Scalastyle rule is added to ban `FileUtils.getTempDirectory`. ### Why are the changes needed? To simplify the code because this test case usage needs only the location. ### Does this PR introduce _any_ user-facing change? No, this is a test-only change. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #51858 from dongjoon-hyun/SPARK-53133. Authored-by: Dongjoon Hyun <dongj...@apache.org> Signed-off-by: Dongjoon Hyun <dongj...@apache.org> --- scalastyle-config.xml | 5 +++++ .../src/test/scala/org/apache/spark/sql/PlanStabilitySuite.scala | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scalastyle-config.xml b/scalastyle-config.xml index e3c2dbd5de54..5cb1b4ecfea7 100644 --- a/scalastyle-config.xml +++ b/scalastyle-config.xml @@ -282,6 +282,11 @@ This file is divided into 3 sections: scala.jdk.CollectionConverters._ and use .asScala / .asJava methods</customMessage> </check> + <check customId="getTempDirectory" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> + <parameters><parameter name="regex">\bFileUtils\.getTempDirectory\b</parameter></parameters> + <customMessage>Use System.getProperty instead.</customMessage> + </check> + <check customId="readLines" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> <parameters><parameter name="regex">\bFileUtils\.readLines\b</parameter></parameters> <customMessage>Use Files.readAllLines instead.</customMessage> diff --git a/sql/core/src/test/scala/org/apache/spark/sql/PlanStabilitySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/PlanStabilitySuite.scala index 59bc28c1c242..e4b5e10f7c3b 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/PlanStabilitySuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/PlanStabilitySuite.scala @@ -23,8 +23,6 @@ import java.nio.file.Files import scala.collection.mutable -import org.apache.commons.io.FileUtils - import org.apache.spark.sql.catalyst.expressions.AttributeSet import org.apache.spark.sql.catalyst.util._ import org.apache.spark.sql.execution._ @@ -138,7 +136,7 @@ trait PlanStabilitySuite extends DisableAdaptiveExecutionSuite { private def checkWithApproved(plan: SparkPlan, name: String, explain: String): Unit = { val dir = getDirForTest(name) - val tempDir = FileUtils.getTempDirectory + val tempDir = System.getProperty("java.io.tmpdir") val actualSimplified = getSimplifiedPlan(plan) val foundMatch = isApproved(dir, actualSimplified, explain) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org