YuweiXiao commented on code in PR #6680:
URL: https://github.com/apache/hudi/pull/6680#discussion_r980665830


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkHoodieTableFileIndex.scala:
##########
@@ -187,12 +189,16 @@ class SparkHoodieTableFileIndex(spark: SparkSession,
    * @param predicates     The filter condition.
    * @return The pruned partition paths.
    */
-  protected def prunePartition(partitionPaths: Seq[PartitionPath], predicates: 
Seq[Expression]): Seq[PartitionPath] = {
+  protected def prunePartition(predicates: Seq[Expression]): 
Seq[PartitionPath] = {
     val partitionColumnNames = partitionSchema.fields.map(_.name).toSet
     val partitionPruningPredicates = predicates.filter {
       _.references.map(_.name).toSet.subsetOf(partitionColumnNames)
     }
     if (partitionPruningPredicates.nonEmpty) {
+      val equalPredicate = 
partitionPruningPredicates.filter(_.isInstanceOf[EqualTo])
+      val names = 
equalPredicate.map(_.asInstanceOf[EqualTo]).map(_.left.asInstanceOf[AttributeReference].name).toArray

Review Comment:
   There is also another case, where we eager loading all partition paths and 
fetch file group lazily. E.g., User specifies a complex predicates on 
partitions or only gives a single predicate for the second partition field. 
   
   So maybe restrict to the following two cases:
   - We have predicate on partition columns, we do lazy loading of file groups. 
And partition loading based on prefix is another optimization to avoid full 
partition listing.
   - If not, we fallback to eager loading of partitions and file groups.
   
   By the way, currently I put an option to control the loading behavior, 
`REFRESH_PARTITION_AND_FILES_IN_INITIALIZATION`. With the above semantic, maybe 
we can remote it and let it be handled automatically. WDYT?



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