in measure/src/main/scala/org/apache/griffin/measure/utils/HdfsUtil.scala [99:125]
def listSubPathsByType(
dirPath: String,
subType: String,
fullPath: Boolean = false): Iterable[String] = {
if (existPath(dirPath)) {
try {
implicit val path: Path = new Path(dirPath)
val fileStatusArray = getFS.listStatus(path)
fileStatusArray
.filter { fileStatus =>
subType match {
case "dir" => fileStatus.isDirectory
case "file" => fileStatus.isFile
case _ => true
}
}
.map { fileStatus =>
val fname = fileStatus.getPath.getName
if (fullPath) getHdfsFilePath(dirPath, fname) else fname
}
} catch {
case e: Throwable =>
warn(s"list path [$dirPath] warn: ${e.getMessage}", e)
Nil
}
} else Nil
}