huaxingao commented on a change in pull request #35691:
URL: https://github.com/apache/spark/pull/35691#discussion_r817422198



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PruneFileSourcePartitions.scala
##########
@@ -46,21 +46,27 @@ private[sql] object PruneFileSourcePartitions
   private def getPartitionKeyFiltersAndDataFilters(
       sparkSession: SparkSession,
       relation: LeafNode,
+      dataSchema: StructType,
       partitionSchema: StructType,
       filters: Seq[Expression],
       output: Seq[AttributeReference]): (ExpressionSet, Seq[Expression]) = {
     val normalizedFilters = DataSourceStrategy.normalizeExprs(
       filters.filter(f => f.deterministic && 
!SubqueryExpression.hasSubquery(f)), output)
     val partitionColumns =
       relation.resolve(partitionSchema, 
sparkSession.sessionState.analyzer.resolver)
+    val dataColumns =
+      relation.resolve(dataSchema, sparkSession.sessionState.analyzer.resolver)
     val partitionSet = AttributeSet(partitionColumns)
-    val (partitionFilters, dataFilters) = normalizedFilters.partition(f =>
-      f.references.subsetOf(partitionSet)
-    )
-    val extraPartitionFilter =
-      dataFilters.flatMap(extractPredicatesWithinOutputSet(_, partitionSet))

Review comment:
       Yes. The `datafilters` is 
   ```
   (p = 0 AND id > 0) OR (p = 1 AND id = 2)
   ```
    and the `extraPartitionFilter` is 
   ```
   (p = 0) OR (p = 1)
   ```
   Then later on, the condition 
   ```
   if (partitionKeyFilters.nonEmpty || (dataFilters.nonEmpty && 
scan.dataFilters.isEmpty))
   ```
   is always true. It keeps on going into that block until StackOverFlow.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to