This is an automated email from the ASF dual-hosted git repository.
yangjie01 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 081bc36356cd [SPARK-46416][CORE] Add `@tailrec` to
`HadoopFSUtils#shouldFilterOutPath`
081bc36356cd is described below
commit 081bc36356cd621998773823ccf814bbbefb433a
Author: YangJie <[email protected]>
AuthorDate: Fri Dec 15 13:22:21 2023 +0800
[SPARK-46416][CORE] Add `@tailrec` to `HadoopFSUtils#shouldFilterOutPath`
### What changes were proposed in this pull request?
This pr adds the `scala.annotation.tailrec` annotation to the
`shouldFilterOutPath` function in `HadoopFSUtils`.
### Why are the changes needed?
To improve performance.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Pass GitHub Actions
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #44345 from LuciferYang/minor-tailrec.
Lead-authored-by: YangJie <[email protected]>
Co-authored-by: yangjie01 <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
---
core/src/main/scala/org/apache/spark/util/HadoopFSUtils.scala | 1 +
1 file changed, 1 insertion(+)
diff --git a/core/src/main/scala/org/apache/spark/util/HadoopFSUtils.scala
b/core/src/main/scala/org/apache/spark/util/HadoopFSUtils.scala
index 4c7b12f60cc8..a4b9ba7bb016 100644
--- a/core/src/main/scala/org/apache/spark/util/HadoopFSUtils.scala
+++ b/core/src/main/scala/org/apache/spark/util/HadoopFSUtils.scala
@@ -349,6 +349,7 @@ private[spark] object HadoopFSUtils extends Logging {
private val underscoreEnd: Regex = "/_[^=/]*$".r
/** Checks if we should filter out this path. */
+ @scala.annotation.tailrec
def shouldFilterOutPath(path: String): Boolean = {
if (path.contains("/.") || path.endsWith("._COPYING_")) return true
underscoreEnd.findFirstIn(path) match {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]