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 10492a00633c [SPARK-53118][CORE][TESTS] Use `Files.write` in `GenericFileInputStreamSuite` 10492a00633c is described below commit 10492a00633c5a8de9b539ce248b364d38322b8e Author: Dongjoon Hyun <dongj...@apache.org> AuthorDate: Mon Aug 4 18:03:56 2025 -0700 [SPARK-53118][CORE][TESTS] Use `Files.write` in `GenericFileInputStreamSuite` ### What changes were proposed in this pull request? This PR aims to use `Files.write` instead of `FileUtils.writeByteArrayToFile` in the abstract test suite `GenericFileInputStreamSuite`. This will be used in the following two test cases. - org.apache.spark.io.GenericFileInputStreamSuite - org.apache.spark.io.NioBufferedInputStreamSuite - org.apache.spark.io.ReadAheadInputStreamSuite ### Why are the changes needed? This is the only place to use `FileUtils.writeByteArrayToFile` to write **2MB** byte array to generate a test input file. We had better use Java's native method for small test data usage. https://github.com/apache/spark/blob/50882d2d88866ef0747ab7b542ac8ebaab4418ae/core/src/test/java/org/apache/spark/io/GenericFileInputStreamSuite.java#L37 ### Does this PR introduce _any_ user-facing change? This is a test only change. ### How was this patch tested? Pass the CIs. **BEFORE** ``` $ git grep FileUtils.writeByteArrayToFile core/src/test/java/org/apache/spark/io/GenericFileInputStreamSuite.java: FileUtils.writeByteArrayToFile(inputFile, randomBytes); ``` **AFTER** ``` $ git grep FileUtils.writeByteArrayToFile ``` ### Was this patch authored or co-authored using generative AI tooling? No. Closes #51837 from dongjoon-hyun/SPARK-53118. Authored-by: Dongjoon Hyun <dongj...@apache.org> Signed-off-by: Dongjoon Hyun <dongj...@apache.org> --- .../test/java/org/apache/spark/io/GenericFileInputStreamSuite.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/org/apache/spark/io/GenericFileInputStreamSuite.java b/core/src/test/java/org/apache/spark/io/GenericFileInputStreamSuite.java index 7d5237eecbbf..bbfa25e60d74 100644 --- a/core/src/test/java/org/apache/spark/io/GenericFileInputStreamSuite.java +++ b/core/src/test/java/org/apache/spark/io/GenericFileInputStreamSuite.java @@ -16,7 +16,6 @@ */ package org.apache.spark.io; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -24,6 +23,7 @@ import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import java.util.concurrent.ThreadLocalRandom; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -44,7 +44,7 @@ public abstract class GenericFileInputStreamSuite { public void setUp() throws IOException { ThreadLocalRandom.current().nextBytes(randomBytes); inputFile = File.createTempFile("temp-file", ".tmp"); - FileUtils.writeByteArrayToFile(inputFile, randomBytes); + Files.write(inputFile.toPath(), randomBytes); } @AfterEach --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org