Skip to content

[SPARK-53132][CORE][SQL][MLLIB] Support list(File|Path)s in SparkFileUtils and JavaUtils #51856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Aug 5, 2025

What changes were proposed in this pull request?

This PR aims to support list(File|Path)s in SparkFileUtils and JavaUtils.

Why are the changes needed?

To provide more convenient Spark file APIs like the following.

-    def getAllFiles: Set[File] = {
-      val files = FileUtils.listFiles(
-        localDir,
-        TrueFileFilter.INSTANCE,
-        TrueFileFilter.INSTANCE).asScala.toSet
-      files
-    }
+    def getAllFiles: Set[File] = Utils.listFiles(localDir).asScala.toSet

Does this PR introduce any user-facing change?

No behavior change.

How was this patch tested?

Pass the CIs.

Was this patch authored or co-authored using generative AI tooling?

No.

@dongjoon-hyun
Copy link
Member Author

Thank you, @HyukjinKwon . Merged to master.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-53132 branch August 6, 2025 00:09
dongjoon-hyun added a commit that referenced this pull request Aug 6, 2025
…anagerDecommissionIntegrationSuite`

### What changes were proposed in this pull request?

This PR is a follow-up to fix the last instance which was missed due to the new line between `FileUtils` and `.listFiles`.
- #51856

### Why are the changes needed?

To simplify the usage consistently.

```scala
-    def shuffleFiles: Seq[File] = {
-      FileUtils
-        .listFiles(new File(sparkTempDir), Array("data", "index"), true)
-        .asScala
-        .toSeq
-    }
+    def shuffleFiles: Seq[File] = Utils.listFiles(new File(sparkTempDir)).asScala
+        .filter(f => Array("data", "index").exists(f.getName.endsWith)).toSeq
```

### Does this PR introduce _any_ user-facing change?

No, this is a test case change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #51865 from dongjoon-hyun/SPARK-53132-2.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants