viirya commented on code in PR #43283:
URL: https://github.com/apache/spark/pull/43283#discussion_r1349869031


##########
core/src/main/scala/org/apache/spark/util/HadoopFSUtils.scala:
##########
@@ -342,13 +344,24 @@ private[spark] object HadoopFSUtils extends Logging {
     exclude && !include
   }
 
+  private val underscore: Regex = "/_[^=/]*/".r
+  private val underscoreEnd: Regex = "/_[^/]*$".r
+
   /** Checks if we should filter out this path. */
   def shouldFilterOutPath(path: String): Boolean = {
-    val exclude = (path.contains("/_") && !path.contains("=")) || 
path.contains("/.")
-    val include = path.contains("/_common_metadata/") ||
-      path.endsWith("/_common_metadata") ||
-      path.contains("/_metadata/") ||
-      path.endsWith("/_metadata")
-    (exclude && !include) || shouldFilterOutPathName(path)
+    if (path.contains("/.") || path.endsWith("._COPYING_")) return true
+    underscoreEnd.findFirstIn(path) match {
+      case Some(dir) if dir.equals("/_metadata") || 
dir.equals("/_common_metadata") => false
+      case Some(_) => true

Review Comment:
   I think `/_ab=123` is not filtered out by `shouldFilterOutPathName`, but it 
is filtered out by this `shouldFilterOutPath`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to