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 2022/03/02 07:44:04 UTC
[GitHub] [spark] huaxingao commented on a change in pull request #35691: [SPARK-38357][SQL][3.2] Fix StackOverflowError with OR(data filter, partition filter)
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: reviews-unsubscribe@spark.apache.org
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