Skip to content

Commit b990196

Browse files
committed
[SPARK-28912] Fixed MatchError in getCheckpointFiles()
1 parent bd3915e commit b990196

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class Checkpoint(ssc: StreamingContext, val checkpointTime: Time)
102102
private[streaming]
103103
object Checkpoint extends Logging {
104104
val PREFIX = "checkpoint-"
105-
val REGEX = (PREFIX + """([\d]+)([\w\.]*)""").r
105+
val REGEX = (PREFIX + """([\d]{9,})([\w\.]*)""").r
106106

107107
/** Get the checkpoint file for the given checkpoint time */
108108
def checkpointFile(checkpointDir: String, checkpointTime: Time): Path = {
@@ -131,8 +131,8 @@ object Checkpoint extends Logging {
131131
try {
132132
val statuses = fs.listStatus(path)
133133
if (statuses != null) {
134-
val paths = statuses.map(_.getPath)
135-
val filtered = paths.filter(p => REGEX.findFirstIn(p.toString).nonEmpty)
134+
val paths = statuses.filterNot(_.isDirectory).map(_.getPath)
135+
val filtered = paths.filter(p => REGEX.findFirstIn(p.getName).nonEmpty)
136136
filtered.sortWith(sortFunc)
137137
} else {
138138
logWarning(s"Listing $path returned null")

0 commit comments

Comments
 (0)