Skip to content

Commit

Permalink
[SPARK-4693] [SQL] PruningPredicates may be wrong if predicates conta…
Browse files Browse the repository at this point in the history
…ins an empty AttributeSet() references
  • Loading branch information
YanTangZhai committed Dec 18, 2014
1 parent efa9b03 commit 70a3544
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@ class AttributeSet private (val baseSet: Set[AttributeEquals])
override def toSeq: Seq[Attribute] = baseSet.map(_.a).toArray.toSeq

override def toString = "{" + baseSet.map(_.a).mkString(", ") + "}"

def isEmpty: Boolean = baseSet.isEmpty
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,9 @@ private[hive] trait HiveStrategies {
// Filter out all predicates that only deal with partition keys, these are given to the
// hive table scan operator to be used for partition pruning.
val partitionKeyIds = AttributeSet(relation.partitionKeys)
val (pruningPredicates, otherPredicates) = predicates.partition { x =>
x.references.baseSet != null &&
!x.references.baseSet.isEmpty &&
x.references.subsetOf(partitionKeyIds)
val (pruningPredicates, otherPredicates) = predicates.partition { predicate =>
!predicate.references.isEmpty &&
predicate.references.subsetOf(partitionKeyIds)
}

pruneFilterProject(
Expand Down

0 comments on commit 70a3544

Please sign in to comment.