Skip to content
Closed
Prev Previous commit
Next Next commit
UT failed #120076, add HIDDEN_FILES_PATH_FILTER
  • Loading branch information
Deegue committed Mar 20, 2020
commit c20c390acd00f2f3adc219ba373fc5f619c2299a
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.collection.JavaConverters._
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer

import org.apache.hadoop.fs.Path
import org.apache.hadoop.fs.{Path, PathFilter}
import org.apache.hadoop.hive.common.{FileUtils, StatsSetupConst}
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.conf.HiveConf.ConfVars
Expand Down Expand Up @@ -616,11 +616,18 @@ private[hive] class HiveClientImpl(
shim.createPartitions(client, db, table, parts, ignoreIfExists)
}

val HIDDEN_FILES_PATH_FILTER: PathFilter = new PathFilter() {
override def accept(p: Path): Boolean = {
val name = p.getName
!name.startsWith("_") && !name.startsWith(".")
}
}

@throws[Exception]
private def isEmptyPath(dirPath: Path): Boolean = {
val inpFs = dirPath.getFileSystem(conf)
if (inpFs.exists(dirPath)) {
val fStats = inpFs.listStatus(dirPath, FileUtils.HIDDEN_FILES_PATH_FILTER)
val fStats = inpFs.listStatus(dirPath, HIDDEN_FILES_PATH_FILTER)
if (fStats.nonEmpty) {
return false
}
Expand Down