You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/17 16:01:48 UTC
[GitHub] [spark] FatalLin commented on a change in pull request #32202: [SPARK-28098][SQL]allow reader could read files from subdirectory for non-partitioned table when configuration is enable
FatalLin commented on a change in pull request #32202:
URL: https://github.com/apache/spark/pull/32202#discussion_r615271527
##########
File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
##########
@@ -277,6 +278,31 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log
result.copy(output = newOutput)
}
+ private def getDirectoryPathSeq(rootPath: Path): Seq[String] = {
+ val enableSupportSubDirectories =
+ sparkSession.conf.getOption("hive.mapred.supports.subdirectories")
+
+ if (enableSupportSubDirectories.isDefined && enableSupportSubDirectories.get.toBoolean) {
+ val fs = rootPath.getFileSystem(sparkSession.sessionState.newHadoopConf())
+ val paths = new scala.collection.mutable.ListBuffer[String]
+
+ val checkingQueue = new mutable.Queue[Path]()
+ checkingQueue.enqueue(rootPath)
+ while (!checkingQueue.isEmpty) {
+ val path = checkingQueue.dequeue()
+ paths.append(path.toString)
+ fs.listStatus(path).foreach(fileStatus => {
+ if (fileStatus.isDirectory) {
+ checkingQueue.enqueue(fileStatus.getPath)
+ }
+ })
+ }
+ paths
Review comment:
Didn't notice the function before, will change it. Thanks.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org