Skip to content

Commit 1c0dae5

Browse files
committed
work on serialization bug.
1 parent 9ba868d commit 1c0dae5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/AttributeSet.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ object AttributeSet {
4343
* and also makes doing transformations hard (we always try keep older trees instead of new ones
4444
* when the transformation was a no-op).
4545
*/
46-
class AttributeSet protected (val baseSet: Set[AttributeEquals]) extends Traversable[Attribute] {
46+
class AttributeSet private (val baseSet: Set[AttributeEquals])
47+
extends Traversable[Attribute] with Serializable {
4748

4849
/** Returns true if the members of this AttributeSet and other are the same. */
4950
override def equals(other: Any) = other match {
@@ -98,4 +99,8 @@ class AttributeSet protected (val baseSet: Set[AttributeEquals]) extends Travers
9899
def intersect(other: AttributeSet) = new AttributeSet(baseSet.intersect(other.baseSet))
99100

100101
override def foreach[U](f: (Attribute) => U): Unit = baseSet.map(_.a).foreach(f)
102+
103+
// We must force toSeq to not be strict otherwise we end up with a [[Stream]] that captures all
104+
// sorts of things in its closure.
105+
override def toSeq: Seq[Attribute] = baseSet.map(_.a).toArray.toSeq
101106
}

0 commit comments

Comments
 (0)