nsivabalan commented on code in PR #12157:
URL: https://github.com/apache/hudi/pull/12157#discussion_r1823480691


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkBaseIndexSupport.scala:
##########
@@ -80,27 +79,22 @@ abstract class SparkBaseIndexSupport(spark: SparkSession,
 
   protected def getPrunedPartitionsAndFileNames(prunedPartitionsAndFileSlices: 
Seq[(Option[BaseHoodieTableFileIndex.PartitionPath], Seq[FileSlice])],
                                                 includeLogFiles: Boolean = 
false): (Set[String], Set[String]) = {
-    val prunedPartitions = prunedPartitionsAndFileSlices.flatMap{ entry =>
-      if (entry._1.isDefined) {
-        Seq(entry._1.get.path)
-      } else {
-        Seq.empty[String]
-      }
+    val (prunedPartitions, prunedFiles) = 
prunedPartitionsAndFileSlices.foldLeft((Set.empty[String], Set.empty[String])) {
+      case ((partitionSet, fileSet), (partitionPathOpt, fileSlices)) =>
+        val updatedPartitionSet = 
partitionPathOpt.map(_.path).map(partitionSet + _).getOrElse(partitionSet)
+        val updatedFileSet = fileSlices.foldLeft(fileSet) { (fileAcc, 
fileSlice) =>
+          val baseFile = 
Option(fileSlice.getBaseFile.orElse(null)).map(_.getFileName)

Review Comment:
   can we have one test written w/ no base file a given file slice. and ensure 
this works w/o any issues. 



-- 
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]

Reply via email to