boneanxs commented on code in PR #10493:
URL: https://github.com/apache/hudi/pull/10493#discussion_r1453101821


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieFileIndex.scala:
##########
@@ -233,8 +233,23 @@ case class HoodieFileIndex(spark: SparkSession,
       //    - Col-Stats Index is present
       //    - Record-level Index is present
       //    - List of predicates (filters) is present
+      val prunedPartitionFileNames: Set[String] = {
+        prunedPartitionsAndFileSlices
+          .flatMap {
+            case (_, fileSlices) => fileSlices
+          }
+          .flatMap { fileSlice =>
+            val baseFileOption = Option(fileSlice.getBaseFile.orElse(null))
+            val logFiles = if (includeLogFiles) {
+              
fileSlice.getLogFiles.iterator().asScala.map(_.getFileName).toList
+            } else Nil
+            baseFileOption.map(_.getFileName).toList ++ logFiles
+          }
+          .toSet
+      }
+
       val candidateFilesNamesOpt: Option[Set[String]] =
-      lookupCandidateFilesInMetadataTable(dataFilters) match {
+      lookupCandidateFilesInMetadataTable(dataFilters, 
prunedPartitionFileNames) match {

Review Comment:
   I mean we can put transformation inside 
`lookupCandidateFilesInMetadataTable`, after `!isMetadataTableEnabled || 
!isDataSkippingEnabled` is checked.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to