Skip to content

Commit 518fe49

Browse files
committed
Expand.projections should not be a Stream
1 parent 581200a commit 518fe49

File tree

1 file changed

+8
-2
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis

1 file changed

+8
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,15 @@ class Analyzer(
279279
* We need to get all of its subsets for a given GROUPBY expression, the subsets are
280280
* represented as sequence of expressions.
281281
*/
282-
def cubeExprs(exprs: Seq[Expression]): Seq[Seq[Expression]] = exprs.toList match {
282+
def cubeExprs(exprs: Seq[Expression]): Seq[Seq[Expression]] = {
283+
// `cubeExprs0` is recursive and returns a lazy Stream. Here we call `toIndexedSeq` to
284+
// materialize it and avoid serialization problems later on.
285+
cubeExprs0(exprs).toIndexedSeq
286+
}
287+
288+
def cubeExprs0(exprs: Seq[Expression]): Seq[Seq[Expression]] = exprs.toList match {
283289
case x :: xs =>
284-
val initial = cubeExprs(xs)
290+
val initial = cubeExprs0(xs)
285291
initial.map(x +: _) ++ initial
286292
case Nil =>
287293
Seq(Seq.empty)

0 commit comments

Comments
 (0)